Skip to main content

rank_by_risk

Function rank_by_risk 

Source
pub fn rank_by_risk<T>(
    entries: &mut Vec<T>,
    top: usize,
    key: impl Fn(&T) -> (&str, f64),
)
Available on crate feature vcs-git only.
Expand description

Rank entries by descending risk score, breaking ties on the file path (ascending), then truncate to the top top (0 = keep all).

The single definition of the bca vcs / POST /vcs / vcs_metrics output ordering, shared by all three front ends so the float-compare and tie-break contract cannot drift between them. key extracts the (path, risk_score) pair from each entry, so callers keep their own per-crate entry types.