Repository navigation
Fix Ruff's smaller-rule findings (ISC, PT, RET, ARG, PTH, E, SIM, RUF, FBT, C4, PERF, PLW, A) - #69
Merged
Merged
Conversation
anth-volk
force-pushed
the
claude/ruff-smaller-rules
branch
2 times, most recently
from
November 2, 2026 15:07
181225f to
7ba6b1f
Compare
anth-volk
added a commit
that referenced
this pull request
Nov 2, 2026
#58 to #69 were rebased onto main after #55 merged, so this merge conflicted in the 18 files this branch had changed on top of #69. Each keeps this branch's side, plus the version commit's bump in pyproject.toml; python -m scripts.rules render regenerated the rules view. The tree differs from e0cfd8e exactly by main's version commit d732aab (2b88444..d732aab). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
claude/ruff-smaller-rules
branch
from
November 2, 2026 16:49
0825c5b to
f5bcfa7
Compare
anth-volk
added a commit
that referenced
this pull request
Nov 2, 2026
#63 to #69 were rebased onto main after #58 merged, so this merge conflicted in the 14 files this branch had changed on top of #69. Each keeps this branch's side, plus the release's version bump in pyproject.toml; python -m scripts.rules render left the rules views as they were. The tree differs from 8776389 exactly by main's release (ff7d34b..a837a06). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
claude/ruff-smaller-rules
branch
from
November 2, 2026 17:47
1bb66e5 to
d82d720
Compare
anth-volk
added a commit
that referenced
this pull request
Nov 3, 2026
#65 to #69 were rebased onto main after #63 merged, so this merge conflicted in the 13 files this branch had changed on top of #69. Each keeps this branch's side, plus the release's version bump in pyproject.toml; python -m scripts.rules render left the rules views as they were. The tree differs from 746e71e exactly by main's release (213b093..ed06bc2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
claude/ruff-smaller-rules
branch
from
November 3, 2026 14:22
6b76595 to
26583bb
Compare
anth-volk
added a commit
that referenced
this pull request
Nov 3, 2026
#67 and #69 were rebased onto main after #65 merged, so this merge conflicted in the 9 files this branch had changed on top of #69. Each keeps this branch's side, plus the release's version bump in pyproject.toml; python -m scripts.rules render left the rules views as they were. The tree differs from 54f2464 exactly by main's release (e233d97..d79aa4d). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
claude/ruff-smaller-rules
branch
from
November 3, 2026 16:32
adb4457 to
6518881
Compare
anth-volk
marked this pull request as ready for review
November 3, 2026 18:56
- ISC004 (108): implicit concatenations in collection literals are wrapped in parentheses; none looked like a missing comma. - PT018, PT011, PT006, PT017 (tests): one assert per condition, match= on the broad pytest.raises, tuple parametrize names, pytest.raises instead of asserting in an except block. - RET, SIM, C4, PERF, RUF005, RUF022, RUF036, RUF059, FBT003, E501 and 9 of 10 PTH findings: the equivalent rewrites (explicit return None, contextlib.suppress, combined if and with statements, comprehensions, unpacking, sorted __all__, wrapped lines, pathlib). - 20 `# noqa`, each with its reason: ARG for signatures fixed by their callers (redirect_request, TypeDecorator, the ServiceModule protocol), FBT001 where callers pass flags positionally, PLW0108 where a lambda must look up a function tests replace, A002 on log_message(format), PTH118 where httpx's uds option takes a str. - Ruff no longer ignores the smaller-rule families. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- _run_files_to_commit takes run_files and at_shutdown as keyword-only arguments, as its sibling methods do, and both calls pass them by name, so FBT001 needs no suppression. - The fake collector builds the upload socket path with str(Path(directory) / "tls.sock"), the same string as os.path.join. - CollectorDelivery passes _http_post and huggingface_token directly: every test replaces them before it builds a delivery, so the lambdas that looked them up at each call were not needed. - The changelog fragment says 15 findings keep a `# noqa` with a reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
claude/ruff-smaller-rules
branch
from
November 3, 2026 18:56
6518881 to
88c4cc6
Compare
anth-volk
added a commit
that referenced
this pull request
Nov 3, 2026
#69 was rebased onto main after #67 merged, so this merge conflicted in the 5 files this branch had changed on top of #69. Each keeps this branch's side, plus the release's version bump in pyproject.toml; python -m scripts.rules render left the rules views as they were. The tree differs from ca655a7 exactly by main's release (6625a18..72205e8). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added a commit
that referenced
this pull request
Nov 3, 2026
Brings in #69's merge and the release commit after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added a commit
that referenced
this pull request
Nov 3, 2026
Carries main (with #69's merge) up the stack. No Python file changes, so the noqa baseline is unchanged. 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.
Fixes #68
Part of #53.
What this does
The fifth of the pull requests stacked on #55 that fix the Ruff findings #55 leaves ignored: the 261 findings here (262 on #55) in the smaller-rule families, after which only
C90andPLRstay on the temporary list. Stacked on #67. Behaviour is unchanged in package code; some tests become stricter.ISC004(108): implicit string concatenations inside lists, tuples and sets are wrapped in parentheses (Ruff's fix), which keeps each value. I read each one for a missing comma between two items; none looked like one. This rule is stable in Ruff 0.16 and a preview rule in the services' Ruff 0.15 (Select every Ruff rule, configured as the simulation API and the Public API configure it #55).PT, 72):PT018(58): one assert per condition.PT011(9):pytest.raisesgets amatch=for the message the code raises on that path.PT006(3): tuple parametrize names.PT017(2):pytest.raisesinstead of asserting inside anexceptblock.RET501,RET502,RET503(15): an explicitreturn None.SIM105(6):contextlib.suppress, with the same exception types.SIM102,SIM117: combinedifandwithstatements.C408,C416,C419,C420: comprehensions.C419makes the Hugging Face module's shutdownall(...)a generator, which stops at the first worker still running. That has the same result, becausewaitonly acquires and releases a lock, and once one worker's wait has used up the deadline, the rest would be non-blocking.PERF401(3),RUF005(4),RUF022,RUF036,RUF059,FBT003.E501(9, plus 15 lines thatISC004's parentheses pushed past 88 columns): wrapped. Three docstrings were rewrapped or reworded, and the Python inside two test scripts' strings was rewrapped; those tests pass.PTHfindings: the pathlib equivalent where it is exact.# noqa, each with its reason above it (20 before round 1):ARG002×12 andARG001: signatures fixed by their callers (redirect_request, SQLAlchemy'sTypeDecorator, theServiceModuleprotocol, theReleaseChangePolicytype).A002×2: overrides oflog_message(format)._run_files_to_committakesrun_filesandat_shutdownas keyword-only arguments, as its sibling methods do (FBT001).str(Path(directory) / "tls.sock"), which gives the same string asos.path.join(PTH118).CollectorDeliverypasses_http_postandhuggingface_tokendirectly instead of through lambdas (PLW0108). I checked every test that replaces either function on the collector module: each does so before it builds a delivery. The one that replaceshuggingface_tokenafterwards builds no further delivery._errors). Two test-local parameters are now keyword-only; both are only passed by keyword.# noqain the tree is unused (RUF100).A helper agent made these changes from a brief I gave it, with the decisions above. I reviewed every package-code change. Of the 68 changed Python files, 24 differ only in layout or docstrings; 12 package modules and 32 test and tool files have code changes.
Test-first record
There is no red step, since nothing changes behaviour in package code.
eb82bc2The fixesruff check .,ruff format --check .and the five guards pass. The 63 test functions whose code changed pass by node ID (164 cases), including everymatch=, the two rewrapped scripts and the keyword-only changes. The changed helper intests/test_collector_contract.pyneeds the pinned collector, so CI's collector job runs it.ruff check .andruff format --check .pass.Review round 1:
ab2efa5Five suppressions dropped, and the fragment's countruff check .,ruff format --check .and the guards pass. The one test that uses the fake collector's TLS upload socket passes by node ID. Ruff prints no invalid-noqawarning since the merge of #67's fix.No other test was run; CI runs them.
CI
No workflow, trigger or script changes, and no environment variable or secret is read differently.
Release
The fragment is
changelog.d/ruff-smaller-rules.changed.md. With #65'saddedfragment below it in the stack, merging releases a minor version (0.12.0); on its own this fragment would give a patch bump.🤖 Generated with Claude Code