Skip to main content

Module metrics

Module metrics 

Source
Expand description

Code metrics computation — LOC, complexity, coverage, git history.

The parser already computes LOC and cyclomatic complexity inline. This module adds:

  • last_modified from git log output
  • Coverage import from pytest JSON/XML reports
  • Query helpers for filtering nodes by metric thresholds

Structs§

CodebaseMetrics
Compute aggregate metrics for the codebase.
FileCoverage
Coverage data for a single file (line-level).

Enums§

MetricsError
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_modified timestamps 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.

Type Aliases§

Result