Add a make cover target so coverage is measurable under the make-targets-only rule
#17
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Coverage is currently unmeasurable without violating repo policy. Only
maketargets and
script/entrypoints may be used, and no target reports coveragedetail — so "which functions are untested?" can only be answered by grepping
test files for identifiers by hand.
That is exactly how the current coverage gaps (#5 rings, #6 sticks, #7 wizard,
#14 traps) had to be found, and it is slow and error-prone.
Note #2 adds
-covertomake test, which prints a single per-packagepercentage. That is a coarse signal — useful as a trend, useless for finding
which function is uncovered. This issue is about the per-function view.
Definition of done
make covertarget that produces a per-function coverage report(the
-coverprofile+go tool cover -funcshape), so specific untestedfunctions are identifiable.
target (
make cover-html) or a documented one-liner in the README..gitignoreis updated so a stray profile can never be committed.
make checkmust not runmake coverand must remain non-file-modifying — policy requires
make checknot to modify any files in therepo. Verify this: run
make check, then confirmgit statusis clean.make checkfully green.TODO.mdupdated in the same commit.(closes #N).Implementation requirements
$(GO_PKGS), the.PHONYline, and a short comment above the target like its neighbors.
script/entrypoints — this repo isexempt.
.golangci.yml.maketargets only for verification.Priority
Low — this is a tooling convenience. It is genuinely more valuable before
the four coverage issues than after, since it turns "did we actually improve
coverage?" into a measurable question, but it does not block them.
Done in
e3ab4abonnext, in #46.make coverwritesbuild/coverage.outand prints the per-function report.make cover-htmldepends oncoverand renders the same profile tobuild/coverage.html, echoing the path — a target rather than a README one-liner, since the one-liner would have been a rawgo tool coverinvocation in the docs.Both use
$(GO_PKGS)and the existing.PHONYline, and both are out ofcheck: they write files, andcheckmust not modify the working tree. Thecheckrecipe now says so in a comment. Coverage artifacts land underbuild/, which.gitignorecovers as a whole.README.md's make-target list names both, and points atbuild/coverage.html.TODO.mdhas a Completed Steps entry in the same commit.Verification,
maketargets only:GOFLAGS=-count=1 make cover-htmlprinted per-function lines andtotal: (statements) 62.6%, thenwrote build/coverage.html. Sample of what the per-function view gives thatmake test's per-package percentage cannot:game/weapons.go:109: wield 0.0%,term/tcell.go:94: ReadChar 0.0%.git status --porcelainempty withbuild/coverage.out,build/coverage.htmlandbuild/rogueall present.GOFLAGS=-count=1 make checkgreen in 22.5s,checkstillfmt-check lint test. The lint layer reportedDONE 13.2swith0 issues., notCACHED; test linescmd/rogue 1.075sandgame 4.049s, no(cached)marker.git status --porcelainempty afterwards.make coverruns without-racedeliberately — coverage is a measurement, not the gate, andmake testis where the race detector runs.