Skip to main content

Module audit_run

Module audit_run 

Source
Expand description

The changed-code audit.

fallow audit, the MCP audit tool and crate::run_audit all run an audit through run, so they give the same introduced and inherited split and the same verdict. A surface supplies an AuditBackend: it runs the three analyses (dead code, duplication, health) and creates the base checkout. This module owns the rest:

  • the base ref: explicit, then FALLOW_AUDIT_BASE, then auto-detection (resolve_audit_base),
  • the check that lets the head run stand in for the base (can_reuse_current_as_base),
  • rename detection, and the base focus set of changed files plus pre-rename paths,
  • the base snapshot: checkout, analysis root, focus remap, dependency scope, and keys,
  • the rename remap of base keys, the degraded type-aware comparison, the clone-group demotion, the verdict, and the introduced flags on the head findings.

Structs§

AuditAnalysesView
The analyses of one audit side. An analysis the surface did not run is None.
AuditAttributionInput
Inputs of attribute.
AuditBase
The base snapshot that attribution compares with.
AuditKeySnapshot
Attribution keys of one audit side (the base commit, or the head run when the base pass is skipped).
AuditOutcome
Attribution result of one audit run.
AuditRun
One completed audit run.
AuditRunInput
Inputs of one audit run.
BaseCoverageInputs
Istanbul coverage inputs of the base pass.
BaseFileReader
A long-lived git cat-file --batch child process that reads the base version of changed files without one git show for each file.
DeadCodeView
The dead-code analysis of one audit side, as the audit reads it.
DuplicationView
The duplication analysis of one audit side, as the audit reads it.
HealthView
The health analysis of one audit side, as the audit reads it.
SharedDiff
An opt-in shared diff that the run already applied, with its source label.

Enums§

AuditBaseError
Why no audit base ref could be resolved.
AuditBaseOrigin
Where an audit base ref came from.
BaseRead
Outcome of one batched base-file read. “The object does not exist at base” and “the pipe or parse failed” stay apart, so a transient git cat-file failure never reads as an empty base file.
DupeDemotionDiffSource
Which diff decided the new-only duplication demotion, so output can name where a demotion came from (issue #2220).

Traits§

AuditAnalyses
The analyses a surface ran for one audit side.
AuditBackend
How one surface runs the analyses of an audit.
BaseCheckout
A checkout of the base commit.

Functions§

attribute
Compare head analyses with a base snapshot, decide the verdict, and set the introduced flags on the dead-code and health findings.
base_coverage_inputs
Coverage inputs for the base-worktree pass.
base_focus_files
The files the base pass covers: the changed files plus the pre-rename path of each rename, so base findings on moved files are in the base snapshot and the rename remap can move them onto their head paths.
branching_keys
Re-key absolute branching paths into the root-relative key space of the audit, so base and head entries join and the rename remap can move them.
can_reuse_current_as_base
Whether the head run can stand in for the base snapshot.
compare
Classify every head finding once against the base snapshot.
demote_preexisting_dupe_introductions
Demote introduced clone groups that hold no added line of the run’s diff.
outcome
Attribution counts, verdict and summary of one comparison.
parse_audit_base_override
Parse a raw FALLOW_AUDIT_BASE value: trimmed, and None when it is empty or only whitespace.
remap_focus_files
Express files (absolute paths under from_root) under to_root.
renamed_files
Detect base..head renames for rename-aware attribution.
resolve_audit_base
Resolve the base ref of an audit rooted at root.
run
Run one audit. Returns None when the run has no changed files.
scope_dependency_findings
Keep a dependency-level finding only when its manifest is in changed_files.
styling_finding_gates
Whether a styling finding escalates to error and so gates the verdict.
styling_rule_severity
The severity of the rule that owns a styling finding code. Styling is verdict-neutral by default (rule warn).
type_aware_attribution_degrade_reason
Why type-aware base and head attribution cannot be compared directly, or None when the comparison is sound (fully syntactic runs included).
type_aware_degrade_warning
The warning that an audit records when it degrades type-aware attribution for reason.
type_aware_gap_signature
Sorted reasons and omissions of the semantic queries that did not complete.