Skip to content

fix: show patch-specific uncovered lines in PR comment#65

Merged
MathurAditya724 merged 1 commit intomainfrom
fix/show-patch-uncovered-lines-in-comment
Mar 26, 2026
Merged

fix: show patch-specific uncovered lines in PR comment#65
MathurAditya724 merged 1 commit intomainfrom
fix/show-patch-uncovered-lines-in-comment

Conversation

@MathurAditya724
Copy link
Copy Markdown
Member

Summary

The "Files with missing lines" table in PR comments previously showed all uncovered lines across each entire file (project-wide counts), which was misleading next to per-file patch coverage percentages. For example, a file might show "272 Missing and 112 partials" when only 1 line in the diff was actually uncovered.

Now in PR context, the table shows only the uncovered lines within the diff, matching Codecov's official comment behavior.

Before (from this comment):

File Patch % Lines
bytes.rs 80.63% ⚠️ 272 Missing and 112 partials
args.rs 88.21% ⚠️ 52 Missing and 18 partials

After (matching Codecov's comment):

File Patch % Lines
args.rs 95.34% ⚠️ 2 Missing
bytes.rs 83.33% ⚠️ 1 partial

Project-wide uncovered line count is still shown in the summary line ("Project has N uncovered lines.").

Changes

  • src/analyzers/patch-analyzer.ts: Add partialLines tracking to PatchFileCoverage — detects lines within the diff that have partial branch coverage (count > 0 but in FileCoverage.partialLines)
  • src/formatters/report-formatter.ts: Accept patchFileBreakdown in options; when available (PR context), use patch-specific missed/partial line counts and per-file patch percentages in the table. Fall back to project-wide counts for non-PR contexts (push events).
  • src/index.ts: Thread patchCoverage.fileBreakdown into the report formatter options
  • Tests: 9 new tests covering patch breakdown display, sorting, fallback behavior, and partial line tracking

…ject-wide counts

The 'Files with missing lines' table in PR comments previously showed all
uncovered lines across the entire file, which was misleading when displayed
next to patch coverage percentages. Now when in PR context, the table shows
only the uncovered lines within the diff (matching Codecov's official behavior).

- Add partialLines tracking to PatchFileCoverage for branch coverage gaps
- Thread patchFileBreakdown from PatchAnalyzer into ReportFormatter
- Fall back to project-wide counts for non-PR contexts (push events)
@github-actions
Copy link
Copy Markdown

Codecov Results 📊

189 passed | Total: 189 | Pass Rate: 100% | Execution Time: 288ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +10
Passed Tests 📈 +10
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 98.21%. Project has 757 uncovered lines.
✅ Project coverage is 56.72%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
report-formatter.ts 97.92% ⚠️ 1 Missing and 3 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    55.95%    56.72%    +0.77%
==========================================
  Files           24        24         —
  Lines         1713      1744       +31
  Branches      1232      1253       +21
==========================================
+ Hits           956       987       +31
- Misses         757       757         —
- Partials        97        98        +1

Generated by Codecov Action

@MathurAditya724 MathurAditya724 marked this pull request as ready for review March 26, 2026 19:30
@MathurAditya724 MathurAditya724 merged commit 21d57b9 into main Mar 26, 2026
9 of 10 checks passed
@MathurAditya724 MathurAditya724 deleted the fix/show-patch-uncovered-lines-in-comment branch March 26, 2026 19:30
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