Skip to content

--lint severity control + inline suppression (#399)#428

Merged
InauguralPhysicist merged 1 commit into
mainfrom
feat/lint-severity-399
Jul 5, 2026
Merged

--lint severity control + inline suppression (#399)#428
InauguralPhysicist merged 1 commit into
mainfrom
feat/lint-severity-399

Conversation

@InauguralPhysicist

Copy link
Copy Markdown
Collaborator

What

--lint exited 1 on any warning with no escape hatch — so the consumer repos that run --lint --json nonzero-on-warning in CI had warnings-as-errors and no opt-out.

  • --lint-level error|warning — the exit-1 threshold. error makes warnings advisory: still printed and still in --json, but exit 0 unless an error-severity diagnostic is present. CI can surface diagnostics without breaking the build on style warnings.
  • # lint: allow <CODE>... — silences those codes (space/comma-separated, or all) on its own line and the line below, so it works trailing on the flagged line or on the line above:
    scratch is compute of x   # lint: allow W001
    # lint: allow W001 W014
    next is other of y
    
    Suppressed diagnostics leave both human and --json output. Scans raw source, since comments are stripped before the AST.

Why now

This is the suppression escape hatch W016 (bare-predicate lint, deferred in #425) was waiting on — a broad lint rule is only safe to ship default-on once consumers can suppress a false-ish positive without pinning a whole file.

Scope

Per-file eigs.json allow-lists remain open on #399 as the contributor on-ramp the issue calls for (it needs a JSON reader wired into the lint path, which pairs naturally with the pkg.eigs/eigs.json machinery).

Verification

test_lint.sh covers both levels, trailing + line-above suppression, advisory-still-prints, and no-over-suppression. Suite 2503/2503; ASan clean on the lint path.

Advances #399

🤖 Generated with Claude Code

…on (#399)

`--lint` exited 1 on any warning with no escape hatch, so consumer repos — the
forcing functions, which run `--lint --json` nonzero-on-warning in CI — had
warnings-as-errors and no way to opt out.

- `--lint-level error|warning` chooses the exit-1 threshold. `error` makes
  warnings advisory: still printed and still in `--json`, but exit 0 unless an
  error-severity diagnostic is present. So CI can surface diagnostics without
  breaking the build on style warnings.
- `# lint: allow <CODE>...` (space/comma-separated, or `all`) silences those
  codes on its own line and the line below — trailing on the flagged construct
  or on the line above. Suppressed diagnostics leave both human and `--json`
  output. Scans raw source (comments are stripped before the AST).

This is the suppression escape hatch W016 was waiting on. Per-file `eigs.json`
allow-lists stay open on #399 as a contributor on-ramp (needs a JSON reader in
the lint path).

docs/DIAGNOSTICS.md "Severity control and suppression"; test_lint.sh covers both
levels, trailing + above suppression, and no-over-suppression. Suite 2503/2503;
ASan clean on the lint path.

Advances #399

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/main.c Dismissed
Comment thread src/main.c Dismissed
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.

2 participants