Skip to main content

compute_risk_batch

Function compute_risk_batch 

Source
pub fn compute_risk_batch(
    names: &[&str],
    graph: &CallGraph,
    test_chunks: &[ChunkSummary],
) -> Vec<RiskScore>
Expand description

Compute risk scores for a batch of function names. Uses pre-loaded call graph and test chunks to avoid repeated queries. Formula: score = caller_count * (1.0 - test_ratio) where test_ratio = min(test_count / max(caller_count, 1), 1.0). Entry-point handling: functions with 0 callers and 0 tests get Medium risk (likely entry points that should have tests). PERF-24: Uses a single forward BFS from all test nodes to build a reachability map, instead of N independent reverse_bfs calls.