Skip to content

fix: show full file paths with links to PR diff in coverage table#67

Merged
MathurAditya724 merged 1 commit intomainfrom
fix/show-full-paths-and-links-in-file-table
Mar 27, 2026
Merged

fix: show full file paths with links to PR diff in coverage table#67
MathurAditya724 merged 1 commit intomainfrom
fix/show-full-paths-and-links-in-file-table

Conversation

@MathurAditya724
Copy link
Copy Markdown
Member

Summary

Fixes #66

The "Files with missing lines" table in PR comments previously showed only the file basename (e.g. mod.rs) and rendered it as plain text. This was problematic because:

  1. Ambiguous names: Multiple files can share the same basename (e.g. two mod.rs files in different directories)
  2. No links: Users couldn't click through to see the actual file diff

Before:

File Patch % Lines
mod.rs 75.00% ⚠️ 2 Missing and 1 partials
mod.rs 80.00% ⚠️ 2 Missing

After:

File Patch % Lines
crates/monty/src/types/mod.rs 75.00% ⚠️ 2 Missing and 1 partials
crates/monty/src/builtins/mod.rs 80.00% ⚠️ 2 Missing

Changes

  • src/formatters/report-formatter.ts:
    • Add GitHubContext interface and githubContext to ReportFormatOptions
    • Replace getFileName() (basename-only) with formatFileCell() which renders the full normalized path, optionally as a markdown link to the PR diff view
    • Add buildPrDiffUrl() helper that constructs GitHub PR diff anchors using SHA-256 of the file path (matching GitHub's #diff-{sha256hex} URL pattern)
    • Supports GHES via configurable serverUrl
  • src/index.ts: Build and pass githubContext from action runtime (github.context + GITHUB_SERVER_URL env var)
  • Tests: 4 new tests for link generation (with context, without context, patch breakdown, GHES) plus updated assertions for full-path rendering

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 27, 2026

Codecov Results 📊

194 passed | Total: 194 | Pass Rate: 100% | Execution Time: 287ms

📊 Comparison with Base Branch

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

All tests are passing successfully.

✅ Patch coverage is 83.33%. Project has 759 uncovered lines.
✅ Project coverage is 56.82%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/index.ts 0.00% ⚠️ 2 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    56.71%    56.82%    +0.11%
==========================================
  Files           24        24         —
  Lines         1744      1753        +9
  Branches      1253      1257        +4
==========================================
+ Hits           987       994        +7
- Misses         757       759        +2
- Partials        98        97        -1

Generated by Codecov Action

The 'Files with missing lines' table previously showed only the basename
(e.g. 'mod.rs') which was ambiguous when multiple files shared the same name.
Now it shows the full relative path and, when in PR context, renders each
file as a link to its location in the GitHub PR diff view.

Closes #66
@MathurAditya724 MathurAditya724 force-pushed the fix/show-full-paths-and-links-in-file-table branch from dfeb599 to c8fd8bb Compare March 27, 2026 04:28
@MathurAditya724 MathurAditya724 marked this pull request as ready for review March 27, 2026 06:33
@MathurAditya724 MathurAditya724 merged commit ac794ed into main Mar 27, 2026
9 of 10 checks passed
@MathurAditya724 MathurAditya724 deleted the fix/show-full-paths-and-links-in-file-table branch March 27, 2026 06:33
@samuelcolvin
Copy link
Copy Markdown

awesome thank you. I'll let you know how I get on.

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.

The new message only contains file names and doesn't render links

2 participants