Expand description
Baseline support: capture the findings of an existing codebase once, then suppress them on later scans so only newly introduced findings are reported.
Each baselined finding is identified by a hash of its rule id, its path relative to the baseline file, its matched text, and a couple of trimmed context lines. Line and column numbers are deliberately excluded so that inserting code above a finding does not invalidate the baseline.
Structs§
- Baseline
- The on-disk baseline file.
- Baseline
Entry - One baselined finding.
Enums§
Constants§
- BASELINE_
FILE - Name of the baseline file looked up in the working directory and its parents.
Functions§
- build
- Build a baseline from a scan result.
- filter
- Drop the findings already recorded in
baselineand return the remaining ones along with how many were filtered. - find_
baseline_ file - Walk up from
startand return the first existing baseline file. - finding_
hash - Stable identity hash of a finding.
- hash_
findings - Hash every finding, reading each source file at most once.
- load
- Read and validate a baseline file.
- project_
root - Best guess at the project root: the closest ancestor holding a
slopguard.toml, else the closest holding a.git, elsestartitself. - relative_
path - Normalize a finding’s path so that
scan .,scan ./srcandscan /abs/pathall hash to the same string. - write
- Write a baseline as pretty-printed JSON with a trailing newline.