Skip to content

Accept known findings through a baseline file - #77

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
feat/baseline
Sep 5, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
feat/baseline

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Summary

Third item of #68: a repository with known findings can adopt the analyzer and fail only on new ones.

  • Acceptance tests first (test: define the baseline file), implementation follows.
  • findings/baseline.py: a finding's fingerprint is its file relative to the root, its rule, its function and the text of its line, never its line number, so code inserted above it does not make it new while a change to the line does. Baseline.of, save, load (JSON, schema 1, counted entries) and partition, which consumes one entry per matching finding.
  • --baseline PATH with --check: the first run writes the file and passes; later runs set the recorded findings apart and exit 1 only for new ones. An unreadable file is a usage error.
  • Report.baselined and with_baseline: the text report ends with 1 finding, 3 baselined, the JSON report lists them under baselined, the SARIF log marks every result's baselineState, new or unchanged.
  • Usage guide: option row and an "Adopting the analyzer on an existing code base" section. The docs test's rule regex is tightened so a SARIF constant is not taken for a rule id.

Part of #68.

@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 5, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit 078d806 into main Sep 5, 2026
10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/baseline branch September 5, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant