Measure test coverage of only the lines a change adds, by joining a unified diff with a Cobertura XML or coverage.py JSON report. Use when asked for diff coverage, patch coverage, or whether the new lines of a PR are tested.
95%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
a/ and b/ prefixes are stripped, \ No newline at end of file is
ignored and CRLF is tolerated. Files whose new path is /dev/null are skipped.class element's filename and its lines/line entries (number,
hits). Backslashes become / and leading ./ is removed. If several classes list the
same line, it is covered when any has hits > 0.files.<path>.executed_lines are covered and
files.<path>.missing_lines are not.A diff path matches a coverage path when they are equal, when the diff path ends with
/ plus the coverage path, or when the coverage path ends with / plus the diff path. The
longest matching coverage path wins. Two different paths of equal length that both match stop
the run with ambiguous_path. A diff path with no match is listed as unmeasured and does not
count toward the percentage.
percent = covered changed lines * 100 / executable changed lines (rounded half up, 1 decimal)A changed line is executable when the coverage report has an entry for it. --fail-under passes
when percent >= threshold; if there are no executable changed lines the run passes.
text: one line per file, path covered/executable [missing ranges], then
Diff coverage: NN.N%.markdown: ## Diff coverage: NN.N% and a File | Covered | Missing lines table.json: files, percent (string or null), passed and unmeasured_files.| Code | Cause |
|---|---|
input_too_large | Diff over 10 MiB or report over 50 MiB. |
invalid_diff | A hunk header is malformed. |
unsafe_xml | The XML contains <!DOCTYPE or <!ENTITY. |
invalid_report | Malformed XML or JSON, missing files, or an unrecognised format. |
ambiguous_path | Two coverage paths of equal length match one diff path. |