Skip to content

lint: adopt a baseline and gate only on new failures - #173

Open
abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:feat/lint-baseline
Open

abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:feat/lint-baseline

Conversation

@abu-tahir-0

Copy link
Copy Markdown

Problem

scan supports baselines; lint did not. A repository with dozens of undocumented parameters could not switch lint on without fixing all of them first. Closes #152.

Solution

  • lint --baseline FILE loads the same baseline format as scan and applies it with the existing triage.apply_baseline: known failures are marked baselined and stay in the report, anything else still gates. A rule that did not exist in the baseline keeps its "new by construction" flag.
  • lint --write-baseline FILE records the current lint failures. This is the missing half for stdio servers: baseline create only takes an endpoint, so without it a --command server had no way to produce the file.
  • Docs in docs/USING.md show the two commands together.

Testing

  • tests/harness/test_stdio_lint.py — two new end-to-end tests against a stdio server:
    • --write-baseline exits 1 and records the failure; re-running with --baseline exits 0 and reports that finding under summary.gating.baselined.
    • removing a rule from the recorded baseline's ruleIds and entries makes that failure gate again and marks it ruleIsNewSinceBaseline.
  • pytest tests/harness/test_stdio_lint.py — 4 passed.
  • ruff check . — clean; mypy — success (56 files).

The full unit suite is unchanged elsewhere; the four -n auto failures in test_population, test_graybox and test_fleet_service are the known environment-dependent ones that also fail on main.

Impact

lint can now be adopted by an existing repository and fail only on regressions, on HTTP and stdio alike.

lint had no baseline, so a repository with forty undocumented parameters
could not turn it on. --write-baseline records today's failures (stdio
included) and --baseline marks them accepted, exactly as scan does, so
the exit code reflects only what is new.

This branch has not been deployed

No deployments
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.

cli: --fail-on-new for lint, using a baseline

1 participant