Skip to content

feat: support D coverage exclusions and preserve exclusion block interiors - #804

Open
jmh530 wants to merge 2 commits into
codecov:mainfrom
jmh530:fix/d-coverage-exclusions
Open

jmh530 wants to merge 2 commits into
codecov:mainfrom
jmh530:fix/d-coverage-exclusions

Conversation

@jmh530

@jmh530 jmh530 commented Oct 13, 2026

Copy link
Copy Markdown

Summary

Add explicit coverage exclusions for D source files and fix exclusion-block serialization in the modern upload payload.

The CLI currently omits .d files from source-file fixes. Separately, the JSON uploader discards exclusion-marker text without expanding block interiors, so only the marker lines are excluded.

Changes

  • Expand exclusion blocks before serializing file fixes, matching the legacy worker's boundary-pairing behavior.
  • Recognize LCOV_EXCL_LINE, LCOV_EXCL_START, LCOV_EXCL_STOP, and LCOV_EXCL_END in D line comments, including indented and trailing comments.
  • Ignore marker text inside ordinary, raw, and backtick strings, character literals, and block comments.
  • Preserve neighboring executable lines and honor --disable-file-fixes.
  • Document supported markers and limitations.

Exclusions are sent as file-fix metadata; the original D .lst reports remain unchanged. Files containing D token or delimited strings conservatively receive no exclusions because those forms require more extensive parsing. Exclusion blocks must be paired and must not nest.

The payload correction and D support are separate commits.

Testing

  • Added regression tests for block expansion, unmatched markers, single-line exclusions, string/comment handling, CRLF input, disabled fixes, and serialized D upload payloads.
  • Upload-related tests: 76 passed, eight failed. All eight failures also reproduce on the untouched baseline in the same local environment; they involve compressed-output snapshots and Click output capture.
  • Ruff lint and formatting checks passed.

AI-Assisted-By: Codex (GPT-6 Astra Medium)

Expand block boundaries before serializing file fixes as line numbers. The JSON uploader previously discarded marker text without expanding the intervening lines, leaving code inside exclusion blocks counted.

Match the legacy worker handling of LCOV_EXCL_START with STOP or END and block-comment boundaries. Keep unmatched markers limited to their own lines and sort the serialized exclusions for deterministic output.

Add payload regressions for paired blocks, multiple blocks, unmatched markers, and single-line exclusions. Update the existing block-comment expectation to include its interior lines.

AI-Assisted-By: Codex (GPT-6 Astra Medium)
Collect LCOV_EXCL_LINE, START, STOP, and END markers from D line comments, including indented and trailing comments. Upload explicit exclusions as file-fix metadata without changing D coverage reports or filtering unmarked executable lines.

Skip ordinary, raw, and backtick strings, character literals, and block comments when scanning for markers. Normalize marker reasons so explanatory text cannot alter block pairing. Conservatively emit no exclusions for files containing token or delimited strings, and document this limitation and the non-nesting block rules.

Add scanner and serialized-payload regressions for literals, nested comments, CRLF input, disabled fixes, and neighboring executable lines. Preserve the disable-file-fixes option.

AI-Assisted-By: Codex (GPT-6 Astra Medium)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant