Repository navigation
Adopt ruff 0.17.1 lint rules - #26
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 pinsruff==0.17.1exactly in.github/workflows/eval.ymland 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__, UP035collections.abcimports, UP037 quoted annotations, SIM114 mergedifbranches, PLR0402from querypilot.evals import cost.Fixed (unsafe fixes, reviewed by hand):
_NaNSentinel.__new__and_Timer.__enter__returntyping.Self(fine onrequires-python >=3.11).sorted(blocked_columns)[0]→min(blocked_columns)invalidator.py, guarded byif blocked_columns:, so it gives the same result.Fixed by hand: PYI036 typed
_Timer.__exit__args (type[BaseException] | None, etc.); SIM102 inreplay.py: the nested guard now returns the row-count condition directly.# noqawith reasons:evals/pipeline.py: the eval harness deliberately turns any per-case exception into a recordedCaseResult(orexecute_error) so one bad case can't crash a suite run.tests/evals/test_cost.py: the warn-once test needs both calls inside onepytest.warnsblock to prove dedup.Overlap with #25: #25 pins
ruff==0.15.22and touchescli.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 takeruff==0.17.1on the pin line and re-runruff check src tests --fix --unsafe-fixes(just the FURB192minline 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