Expand description
Source comment markers that exclude or tolerate a region of a file in
coverage diff.
--ignore-filename-regex (and its coverage.yaml twin) drops a whole
file from both reports, but the noise it exists to silence is almost always
narrower than a file: one function gated on a runtime CPU-feature check is
compiled into the denominator on every run yet executed only on a host that
has the instruction, so it flips whenever the baseline and head runs draw
different runner CPUs. Excluding the file hides far more real coverage than
noise.
Naming the region in config is not an option either: line numbers are
invalidated by every edit above them, and function extents are absent from
the lcov FN: records (start line + mangled symbol only). So the region is
delimited in the source itself, and each revision’s own source is scanned —
head from the worktree, base from the base blob — which means no line number
is ever stored, and a region that moves, grows, or disappears between base
and head is handled by construction.
A region is opened by a comment naming a kind and a mandatory reason, and
closed by an end comment; there is also a single-line form. The syntax is
documented, with examples, in docs/coverage.md — deliberately not here:
see INTRODUCER for why this file must not contain a literal marker.
Two kinds, differing in what they do to the reports:
MarkerKind::Ignore— the lines are removed from both reports before any analysis, so they cannot move any number. The scoped twin ofignore-filename-regex.MarkerKind::Tolerate— the lines stay, so the percentage stays honest; only the delta signals are masked, by scoring each tolerated head line with its baseline hit status.
Matching is a plain substring on any line, so it works in any comment syntax and never depends on parsing the host language. A marker inside a string literal is therefore matched too — accepted, and documented.
Structs§
- File
Markers - The regions of one file, plus the line sets they expand to.
- Region
- One marked region, as a 1-based inclusive line span.
Enums§
- Marker
Kind - What a marked region does to the reports.
Constants§
- INTRODUCER
- The literal that introduces every marker.
Functions§
- scan
- Scans
textfor coverage markers, returning the regions in source order.