Skip to content

Make the lint gate deterministic and enforce the documented rule set - #37

Merged
gavinbee merged 1 commit into
mainfrom
36-ruff-lint-determinism
Aug 7, 2026
Merged

Make the lint gate deterministic and enforce the documented rule set#37
gavinbee merged 1 commit into
mainfrom
36-ruff-lint-determinism

Conversation

@gavinbee

@gavinbee gavinbee commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Closes #36. Unblocks #35, which is red through no fault of its own.

The problem

CONTRIBUTING.md line 79 has documented select = ["E","F","I","W"] since the lint gate existed, but no config file ever enforced it — there's no pyproject.toml, ruff.toml, or .ruff.toml in this repo. So ruff check . ran with whatever the installed version defaults to, and requirements-dev.txt carries ruff>=0.6.

Net effect: the gate's rule set can change with no commit to this repo. main is green because it hasn't re-run since a newer ruff landed, not because it's clean.

Not a no-op

Adding the documented config was more than paperwork — the documented selection is stricter in a direction this code had never been checked against:

Configuration Findings
No config (before) 4 — SIM102 ×2, PLW1510, in scripts/apply-settings.py
lint.select = ["E","F","I","W"] 8 — all E501 line-too-long

So both sets are real and disjoint. This PR wraps the 8 long lines (7 in apply-settings.py, 1 in test_apply_settings.py) — all mechanical, no behaviour change.

SIM102 and PLW1510 sit outside the documented selection and no longer fire. Widening the selection to include them is a deliberate policy change and belongs in its own PR, since every repo cites this standard as org-wide. Worth noting PLW1510 isn't a latent bug here anyway: apply-settings.py inspects result.returncode immediately after the call, so "fixing" it with check=True would change the control flow.

Why pin the selection, not ruff

Pinning ruff exactly would contradict the >= minimums policy in CONTRIBUTING.md § Dependencies, and would only defer the problem to the next bump. Pinning the rule selection makes the gate deterministic while leaving that policy intact.

Verification

ruff check .   ->  All checks passed!
pytest -q      ->  11 passed

This fixes .github only. The same documented-but-unenforced selection affects other
repos, and two of them don't lint at all — tracked in #38.

CONTRIBUTING.md line 79 needed no edit — it already described this selection. It's now true.

🤖 Generated with Claude Code

CONTRIBUTING.md has claimed select = ["E","F","I","W"] since the lint gate was
introduced, but no config file ever enforced it -- there is no pyproject.toml,
ruff.toml or .ruff.toml in this repo. So `ruff check .` ran with whatever the
installed version's defaults happened to be, and requirements-dev.txt carries
ruff>=0.6, meaning a new ruff release can change the gate's rule set with no
commit here.

That is what just happened. main is green only because it has not re-run since a
newer ruff landed; PR #35, which changes two markdown files and no Python, went
red on SIM102 and PLW1510 findings in scripts/apply-settings.py.

Adds the config, which turned out not to be a no-op: the documented selection is
stricter in a direction the code had never been checked against, surfacing 8
E501 violations that ruff's defaults ignore. Those are wrapped here -- all
mechanical, no behaviour change. Conversely SIM102 and PLW1510 sit outside the
documented selection and no longer fire; widening the selection to include them
is a deliberate policy change for a separate PR, since every repo cites this
standard.

Pins the rule selection rather than the ruff version, so the `>=` minimums
policy stays intact while the gate stops moving on its own.

Closes #36

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gavinbee
gavinbee merged commit 7357498 into main Aug 7, 2026
1 check passed
@gavinbee
gavinbee deleted the 36-ruff-lint-determinism branch August 7, 2026 04:20
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.

CI lint gate is non-deterministic: ruff is unpinned and unconfigured

1 participant