code complexity & repetition analysis tool
mccabre docs src coverage.md
1.8 kB · 53 lines
Markdown
at main

Coverage #

Mccabre can read LCOV files and report line coverage in the terminal, JSONL, or a static HTML report.

Summary Report #

Use coverage report with an LCOV file:

mccabre coverage report --from lcov.info

The command prints a terminal summary with total files, total lines, covered lines, uncovered lines, overall rate, and per-file uncovered ranges. Files are sorted from lowest coverage to highest coverage.

Optional Outputs #

# Write one JSON object per covered source file
mccabre coverage report --from lcov.info --jsonl coverage.jsonl

# Write a static HTML coverage report
mccabre coverage report --from lcov.info --html coverage-html/

# Normalize absolute LCOV source paths against a repository root
mccabre coverage report --from lcov.info --repo-root /path/to/repo

When --jsonl or --html is provided, Mccabre writes that artifact and still prints the terminal summary.

Detailed Views #

Use coverage show to inspect coverage by file or directory:

# Show all files from the LCOV data
mccabre coverage show --from lcov.info

# Show coverage for one directory
mccabre coverage show --from lcov.info src/

# Show annotated source for one file
mccabre coverage show --from lcov.info src/lib.rs

For file views, covered lines are marked as hits, uncovered executable lines as misses, and non-covered source lines as neutral. Long runs of neutral lines are truncated after five consecutive lines by default.

mccabre coverage show --from lcov.info src/lib.rs --truncate-threshold 8

LCOV Input #

Mccabre reads standard SF: source file records and DA: line hit records. Invalid DA: lines are skipped, and empty LCOV files produce a "No coverage data found" message.