Skip to content

Coverage: lcov/JSON exporters should emit zero-hit entries for uncovered executable lines #203

@frostney

Description

@frostney

Context

From PR #201 code review (CodeRabbit comment on units/Goccia.Coverage.Report.pas:179).

Problem

The lcov and Istanbul JSON exporters only serialize lines with HitCount > 0. Uncovered executable lines are omitted from DA: entries (lcov) and s/statementMap (JSON). This means downstream tools like Codecov and Coveralls will overreport coverage because they only see the lines that were hit, not the full set of executable lines.

The console summary and detail view correctly show uncovered lines (via BuildExecutableLineFlags), but the file exporters don't use this information.

Proposed Fix

Update WriteCoverageLcov and WriteCoverageJSON to:

  1. Load the source file and call BuildExecutableLineFlags to determine executable lines
  2. Emit DA:line,0 entries for executable lines that have zero hits
  3. Use the executable line count for LF: (lines found) instead of only counting hit lines

This requires the exporters to have access to the source files (or the pre-computed executable line flags), which means either passing the source paths through or storing the flags on TGocciaFileCoverage.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions