coverage_report.py
coverage_report.py — render coverage.py JSON as a colored per-file table.
Overview
coverage_report.py — render coverage.py JSON as a colored per-file table.
make coverage runs the suite under coverage.py, dumps JSON, and pipes the
path here: one row per source file — hue-coded percentage (green >= 80,
yellow >= 50, red below, dim zero), a 22-cell bar, covered/total statements —
grouped by directory, with a TOTAL line. Colors turn off when stdout isn't a
tty, so redirecting to a file stays clean. Stdlib only.
flowchart TD main --> _bar main --> _c main --> _hue
API
F_c(code: str, s: str) -> str
Wrap s in an ANSI color unless stdout is not a tty (pipes stay plain).
_bar, mainF_hue(p: float) -> str
The ANSI hue for a percentage: dim zero, green/yellow/red by threshold.
_bar, mainF_bar(p: float) -> str
A BARW-cell block bar, filled proportionally and colored by _hue.
main · calls _c, _hueFmain(argv: list[str]) -> int
Read a coverage.py JSON report (argv[0]) and print the grouped table.
_bar, _c, _hue