crapper now reports a region as (start, end, count). The join still
unpacked (line, count), so the Swift coverage tests crashed, and a
mutation on the last line of a covered region was left uncovered.
line_covered decides each line. A nested region with count zero stays
uncovered, and a line in no region stays uncovered. An xccov summary
is unchanged.
The file-wide mutator run then found six older survivors in the path
join. A trailing slash still marks the file, the first of two equal
paths keeps its hits, and a shorter prefix beats a shorter suffix.
Comparisons that could not change a result are gone.
Proved by pytest (125 passed, 1 skipped; swift is not installed).
crapper's worst score besides parse_args is _prepare_coverage at 9.4;
_swift_hits is 6.0. dryer --threshold 0.8 reports no candidates.
mutator on src/mutator/coverage.py killed 49, with 0 survived and 0
uncovered.
Co-authored-by: Robert C. Martin <[email protected]>
llvm-cov JSON and xccov JSON land in target/coverage/swift. crapper
turns those into regions or function summaries. A region with a hit
marks that line covered. An xccov summary has no lines, so the function
line is covered when the summary's covered count is above zero. A file
missing from the report stays uncovered and is not run.
Proved by tests/test_coverage.py, which failed first because a Swift
file with a report still returned no lines, and by a scan that marks
an unhit line uncovered. The reports are the same JSON shapes crapper
reads; mutator does not parse them itself.
Co-authored-by: Robert C. Martin <[email protected]>
Why: every Go run printed "No coverage data for <file>; its sites are
uncovered". `go test -coverprofile` keys files by import path
(`github.com/acme/tool/cmd/tool/main.go`); mutator looked them up by
absolute disk path (`/.../tool/cmd/tool/main.go`). Neither path ends with
the other, so no Go file ever matched and only --no-coverage ran sites.
What: `_go_lines` asks crapper's `go_import_name` for the profile's name
of the file (nearest go.mod module line plus path inside the module) and
`_lookup` tries that name as an exact key, then the existing suffix
match. Other languages pass no name and are unchanged. Needs crapper
c757ec7 or later.
Proof: two new specs (module at the root, module in a subdirectory with
a different name) failed with None first, now pass; 78 pass. crapper:
_go_lines 6.0, covered_lines 5.0, _lookup 4.0. dryer: no candidates.
mutator on the changed lines: one equivalent survivor (insert(0) vs
insert(1)) removed by appending the name; no survivors left.
A package path is one argument. Git status uses NUL records and returns git's status. A failed coverage command leaves reports unread, coverage keeps the longest path match, and site walks no longer recurse.