Expand description
Stable per-finding keys and audit ledgers that compare head results against a base snapshot, plus helpers that annotate output JSON with introduced-vs-pre-existing attribution.
Structs§
- Audit
Comparison - One-pass audit comparison shared by attribution, verdict, and annotations.
- Audit
Domain Ledger - Stable-key membership for one non-dead-code audit domain.
- Audit
Finding Record - One dead-code finding classified for audit comparison.
- Dead
Code Audit Ledger - Exhaustive dead-code comparison ledger shared by audit verdict and output.
Functions§
- annotate_
dead_ code_ json - Insert
"introduced": boolinto every dead-code finding object in the serialized JSON by re-deriving each key and testing membership against the base snapshot. JSON arrays must be in the same order as the typedresultscollections they were serialized from. - annotate_
domain_ demotions_ json - Attach a
demotion_reasonto demoted entries of an audit JSON array, matching entries to demoted membership by array position. Non-demoted entries are left untouched so output without demotions stays byte-identical (issue #2220). - annotate_
domain_ json - Attach precomputed introduced membership to an audit JSON array.
- annotate_
dupes_ json - Insert
"introduced": boolinto eachclone_groupsobject in serialized duplication JSON, matching groups to the typed report by array position. - annotate_
health_ json - Insert
"introduced": boolinto eachfindingsandstyling_findingsobject in serialized health JSON, matching entries to the typed report by array position. - annotate_
stale_ suppressions_ json - Annotate the sole legacy dead-code collection without a typed
introducedfield. Every wrapper-backed collection is annotated from the persistedAuditComparisoninstead. - dead_
code_ audit_ ledger - Build the exhaustive dead-code comparison ledger once for an audit run.
- dead_
code_ keys dead_code_keys,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-collectionofffilter branches incrates/engine/src/dead_code.rs(apply_rule_severities). The severity of each record comes from theRuleSeveritytable incrates/engine/src/effective_severity.rs, whose visitors are exhaustive. TypeScript mirror:editors/vscode/scripts/codegen-contracts.mjsderives backwards-compatible aliases fromfallow schemats_aliasrows.- dupe_
group_ key - Attribution key for one clone group:
dupe:<sorted files joined by |>:<tokens>:<lines>:<fragment hash>. The fragment hash keeps distinct groups spanning the same files apart; line positions are excluded so a group survives shifts within its files. - dupes_
keys - Attribution key set for every clone group in a duplication report.
- health_
finding_ key - Attribution key for one complexity finding:
complexity:<path>:<function>:<exceeded metric>. Line numbers are deliberately excluded so a finding survives unrelated edits above it. - health_
keys - Attribution key set for every complexity finding in a health report.
- preexisting_
dupe_ group_ keys - Keys of clone groups whose every instance lies entirely outside the diff’s added lines: no instance range contains an added line, so the changeset did not write the duplicated text, and the group only became reportable (under a new attribution key) because the changeset removed code elsewhere; deduplicating one region can create or re-shape a clone group across files (issue #2164). New-only gating demotes these groups to inherited so a clone-removal refactor is not failed by the duplication it did not write. An instance whose path cannot be mapped into the diff’s namespace is treated as touched, so its group keeps gating.
- relative_
key_ path - Canonical path form used inside attribution keys: root-relative with
forward slashes on every platform. Paths outside
rootkeep their simplified absolute form so keys stay unique. - remap_
keys_ for_ renames - Remap root-relative path tokens inside base-snapshot attribution keys so a finding on a renamed file matches its base counterpart under the old path.
- retain_
introduced_ dead_ code - Retain only findings whose audit key was NOT present in
base(i.e. was introduced on the current branch). - styling_
finding_ key - Attribution key for one styling finding:
styling:<code>:<sub kind>:<path>:<line>:<value>. - styling_
keys - Attribution key set for every styling finding in a health report.