Skip to content

Adopt ruff 0.17.1 lint rules - #26

Merged
nickklos10 merged 1 commit into
mainfrom
chore/ruff-0.17.1
Oct 21, 2026
Merged

nickklos10 merged 1 commit into
mainfrom
chore/ruff-0.17.1

Conversation

@nickklos10

Copy link
Copy Markdown
Owner

CI's lint job installed ruff unpinned, so it drifted to 0.17.1, whose expanded default rule set reports 49 findings on main. This pins ruff==0.17.1 exactly in .github/workflows/eval.yml and fixes every finding. There is no [tool.ruff] config; no rule fought the codebase broadly enough to justify disabling it.

Fixed (auto, safe): I001 import sorting (most files), RUF022 sorted __all__, UP035 collections.abc imports, UP037 quoted annotations, SIM114 merged if branches, PLR0402 from querypilot.evals import cost.

Fixed (unsafe fixes, reviewed by hand):

  • PYI034: _NaNSentinel.__new__ and _Timer.__enter__ return typing.Self (fine on requires-python >=3.11).
  • ISC004: three implicit string concatenations inside lists are now parenthesized, so the result is unchanged and it is explicit that they form one element.
  • FURB192: sorted(blocked_columns)[0] → min(blocked_columns) in validator.py, guarded by if blocked_columns:, so it gives the same result.

Fixed by hand: PYI036 typed _Timer.__exit__ args (type[BaseException] | None, etc.); SIM102 in replay.py: the nested guard now returns the row-count condition directly.

# noqa with reasons:

  • BLE001 ×3 in evals/pipeline.py: the eval harness deliberately turns any per-case exception into a recorded CaseResult (or execute_error) so one bad case can't crash a suite run.
  • PT031 in tests/evals/test_cost.py: the warn-once test needs both calls inside one pytest.warns block to prove dedup.

Overlap with #25: #25 pins ruff==0.15.22 and touches cli.py, core/client.py, validation/validator.py, tests/evals/test_cli.py, which this PR also touches, mostly import order. Linting #25's versions of those files under 0.17.1 shows only the same pre-existing findings and nothing new. Whichever PR merges second needs to take ruff==0.17.1 on the pin line and re-run ruff check src tests --fix --unsafe-fixes (just the FURB192 min line beyond the safe fixes).

Verification: ruff check src tests → All checks passed (0.17.1); pytest → 397 passed (Python 3.12, .[dev,eval]).

🤖 Generated with Claude Code

Pin CI lint to ruff==0.17.1 (it was unpinned and drifted) and fix the 49
findings the newer default rule set reports on src and tests.

- Auto-fixed: I001, RUF022, UP035, UP037, SIM114, PLR0402.
- Reviewed unsafe fixes: PYI034 (Self), ISC004 (parenthesized concatenation),
  FURB192 (min over a non-empty set).
- By hand: PYI036 (__exit__ annotations), SIM102 (replay guard).
- noqa with reasons: BLE001 x3 in evals/pipeline.py (the harness records any
  case failure as a result), PT031 in test_cost.py (dedup test needs both
  calls in one warns block).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nickklos10
nickklos10 merged commit cfbc135 into main Oct 21, 2026
5 checks passed
@nickklos10
nickklos10 deleted the chore/ruff-0.17.1 branch October 21, 2026 02:46
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