Skip to content

Maximally strict warnings: broaden the ruff rule set and raise pyright above basic #197

Description

@cdeust

Why

warnings_strict — "projects MUST be maximally strict with warnings in the software produced by the project, where practical" — is a MUST at OpenSSF silver and the second criterion blocking the badge (project 13836).

Today the gates block regression but are not strict:

  • ruff runs its default rule set (E4, E7, E9, F). A run with --select ALL minus the docstring/annotation/comma/TODO families reports 3,545 findings (measured 2026-07-27, ruff 0.15.20, mcp_server/). Largest classes: PLC0415 import-outside-top-level (405), BLE001 blind-except (349), PLR2004 magic-value comparison (339), E501 line-too-long (263), S110 try-except-pass (68), S608 string-built SQL (39, all identifier-allowlisted — see docs/ASSURANCE-CASE.md §5).
  • pyright runs typeCheckingMode: "basic" behind a per-rule ratchet whose committed floors total 568 diagnostics (typecheck-baseline.json).

CI fails on any ruff finding under the current rule set and on any rule above its floor, so nothing accumulates — but a rule that was never enabled cannot fail, and that is what this criterion is about.

Approach

Rule family by rule family, each as its own PR, so review stays reviewable:

  1. Enable the mechanical families first (I imports, UP pyupgrade, C4, SIM, PIE, RSE, PERF) — mostly autofixable; land the fix and the config change together.
  2. Then the judgement families (B, S, TRY, RET, ARG, PTH, PL*), fixing rather than blanket-ignoring. A rule the project deliberately rejects is disabled in pyproject.toml with a written reason, not left unselected by accident — that distinction is the whole point.
  3. Raise pyright from basic toward standard, and keep burning the ratchet floors down (they only come down: see docs/provenance/pyright-remediation-plan.md).

Acceptance criteria

  1. [tool.ruff.lint] select is explicit and broad; every excluded family carries a comment stating why it is excluded.
  2. ruff check . is clean at the new rule set, and CI still fails on any finding.
  3. pyrightconfig.json is above basic, with the ratchet floors at or below their current values — no floor is raised to make the build pass.
  4. docs/ASSURANCE-CASE.md § "What this assurance case does NOT claim" drops the strictness caveat.
  5. .bestpractices.json flips warnings_strict to Met, citing the configuration rather than a promise.

Blocks: OpenSSF silver (project 13836). Roadmap item 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions