Skip to main content

knowledge_factor_from_islands

Function knowledge_factor_from_islands 

pub fn knowledge_factor_from_islands(
    rows: &[KnowledgeIslandRow],
    total_live_files: u64,
) -> Option<FactorTile>
Expand description

Build the Knowledge factor tile from knowledge_islands output as a fallback when code_familiarity data is unavailable (e.g. repositories whose primary language has no complexity_metrics support).

Every row run_knowledge_islands emits is a departed knowledge island by construction — its SQL keeps only files whose main author is already past --departed-threshold-days — so rows.len() is exactly the count of departed islands. The tile scores their prevalence across the live tree rather than the (always-1.0) departed-vs-active share:

headline = 100 × (1 − departed_islands / total_live_files), clamped to [0, 100].

Returns None when there are no island rows (the caller then falls back to the familiarity path) or when total_live_files is zero (no denominator).

§Parameters

  • rows: departed knowledge-island files from run_knowledge_islands.
  • total_live_files: count of files present at HEAD (latest change_typedeleted) — the prevalence denominator. Counted plainly, without the --min-revs gate the island rows honour, so the ratio compares departed islands against the full live tree.