Expand description
Code metrics computation — LOC, complexity, coverage, git history.
The parser already computes LOC and cyclomatic complexity inline. This module adds:
last_modifiedfromgit logoutput- Coverage import from pytest JSON/XML reports
- Query helpers for filtering nodes by metric thresholds
Structs§
- Codebase
Metrics - Compute aggregate metrics for the codebase.
- File
Coverage - Coverage data for a single file (line-level).
Enums§
- Metrics
Error - Errors from metrics operations.
Functions§
- compute_
codebase_ metrics - Compute aggregate metrics from a set of CodeNodes.
- enrich_
with_ coverage - Enrich CodeNodes with coverage percentages from a coverage map.
- enrich_
with_ git_ timestamps - Enrich CodeNodes with
last_modifiedtimestamps from git log. - high_
complexity_ nodes - Find nodes with cyclomatic complexity above a threshold.
- largest_
nodes - Find the largest nodes by LOC.
- low_
coverage_ nodes - Find nodes with coverage below a threshold (0.0 to 1.0).
- parse_
coverage_ json - Parse a coverage.json (pytest-cov JSON format) into a file-level coverage map.