Skip to main content

dead_code_keys

Function dead_code_keys 

Source
pub fn dead_code_keys(
    results: &AnalysisResults,
    root: &Path,
) -> FxHashSet<String>
Expand description

Build the set of audit attribution keys for all dead-code findings in results.

Each key is a stable string that uniquely identifies one finding across runs (e.g. unused-file:src/dead.ts, unused-export:src/a.ts:Foo). retain_introduced_dead_code and annotate_dead_code_json use the same key format to diff the current run against a base snapshot.

This destructure is deliberately exhaustive: adding a field to AnalysisResults must fail compilation here so the author decides explicitly whether the new finding type needs an audit key (add a loop) or has no key representation today (bind with underscore and document why).

Sibling exhaustive sites: retain_in_scope in crates/engine/src/result_scope.rs, retain_introduced_dead_code. Non-exhaustive siblings the compiler will NOT flag (wire manually when a finding type is added): annotate_dead_code_json (same key formats, this file) and the per-collection off filter branches in crates/engine/src/dead_code.rs (apply_rule_severities). The severity of each record comes from the RuleSeverity table in crates/engine/src/effective_severity.rs, whose visitors are exhaustive. TypeScript mirror: editors/vscode/scripts/codegen-contracts.mjs derives backwards-compatible aliases from fallow schema ts_alias rows.