Skip to content

ci: report least-covered functions in coverage summary#1083

Draft
cpuguy83 wants to merge 1 commit into
mainfrom
cpuguy83/covreport-missing-coverage
Draft

ci: report least-covered functions in coverage summary#1083
cpuguy83 wants to merge 1 commit into
mainfrom
cpuguy83/covreport-missing-coverage

Conversation

@cpuguy83

@cpuguy83 cpuguy83 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

What

The coverage-report CI job's job summary previously showed only the total coverage percentage, giving no visibility into what is under-tested.

This adds cmd/covreport, a small testable helper that parses go tool cover -func output and renders a ## Missing coverage markdown section: a collapsible <details> table of the top 20 functions below 100% coverage, sorted lowest-first (Coverage | Function | Location). It's wired into the coverage-report job so the list is appended to $GITHUB_STEP_SUMMARY right after the existing total.

How

  • The tool reuses coverage/summary.txt (already produced by the tee on the go tool cover -func line), so no additional profile parsing is needed.
  • Flags: -input (default stdin), -top (default 20).
  • Skips the total: line and malformed lines; emits "All tracked functions are fully covered." when nothing is below 100%.
  • Reports only — it never gates the build.

Tests

cmd/covreport/main_test.go covers parsing, total:/malformed exclusion, the 100% filter, ascending sort with deterministic tie-breaks, top-N capping, full-list vs capped summaries, empty/all-covered input, and flag parsing.

Verified locally: go test, go vet, the repo's custom linter, and go build ./cmd/... all pass; smoke-tested against real -func output.

The coverage-report job's job summary previously showed only the total
coverage percentage, giving no visibility into what is under-tested.

Add cmd/covreport, which parses `go tool cover -func` output and renders a
collapsible markdown section listing the top 20 functions below 100%
coverage, sorted lowest-first. Wire it into the coverage-report job so the
list is appended to $GITHUB_STEP_SUMMARY after the existing total.

The tool reuses coverage/summary.txt (already produced by the `tee` on the
`go tool cover -func` line), so no additional profile parsing is needed. It
reports only; it never gates the build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 force-pushed the cpuguy83/covreport-missing-coverage branch from bcf7522 to b57447f Compare June 8, 2026 01:02
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