DM-55493: scope PLR0917 for ruff 0.16 - #301
Merged
Merged
Conversation
ruff 0.16.0 stabilizes PLR0917 (too-many-positional-arguments), which flags the create() classmethod factory at 7 positional parameters. Insert a bare `*,` after `cls` so every dependency is passed by keyword. This matches the sibling LsstTexmfIngestService.create and the class's own __init__, both of which are already keyword-only. The single call site (Factory.create_sdm_schemas_ingest_service) already used keyword arguments, so no caller changes were required.
ruff-shared.toml already sets [lint.isort] split-on-trailing-comma = false, so the pyproject copy is dead config. Clears the toml-not-redundant check.
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.
Background
ruff 0.16.0 stabilized a batch of preview rules. Two of them now fire on this
repo's existing configuration without any code change on our side:
PLR0917(too-many-positional-arguments) — flags callables taking morethan five positional parameters.
ISC004(explicit-string-concatenation) — no occurrences inook.Because ook selects broad rule families, these arrive automatically the moment
the pinned ruff version moves to 0.16. This PR gets ahead of that so the version
bump itself is a no-op.
The repo's pinned
ruff-pre-commitrev is older than 0.16 and does notsurface these rules, so this was verified out-of-band with:
The single finding
SdmSchemasIngestService.create()— the async classmethod factory — acceptedseven positional parameters (
http_client,logger,link_store,sdm_schemas_store,gh_factory,github_owner,github_repo).Disposition: fix, not ignore
Fixed by inserting a bare
*,aftercls, making every dependencykeyword-only. No parameter was removed, reordered, or renamed, and no
noqawas added.
A scoped ignore was rejected because the rule is pointing at something real
and the fix is free here:
"naturally positional" — there is no argument whose meaning is obvious from
position alone, so nothing warrants staying positional.
*,goes right aftercls.__init__is alreadyfully keyword-only, and so is the sibling factory
LsstTexmfIngestService.create()(src/ook/services/ingest/lssttexmf.py).SdmSchemasIngestService.createwas the odd one out.loggerandhttp_clientwere adjacent andtrivially transposable at a call site, as were the two
strparametersgithub_owner/github_repo.Call sites
Grepped
SdmSchemasIngestServiceacrosssrc/,tests/, and all other filetypes, plus
super().__init__(for subclass constructors.There is exactly one invocation:
src/ook/factory.py:408—Factory.create_sdm_schemas_ingest_service()It already passed all seven arguments by keyword, so no call sites needed
changing. The class has no subclasses, so there is no
super().__init__()toupdate. Remaining matches are prose only (a docstring in
tests/support/github.py, a test-data README, and a planning doc).This is an internal service API —
create()is not exported or part of ook'sHTTP surface — so the change is not breaking for any consumer.
Validation
uvx ruff@0.16.0 check --select PLR0917,ISC004 .→ All checks passed (was1 error).
uv run --only-group=nox nox -s typing test:typing(mypy, 202 source files) → Success: no issues foundtest→ 451 passed, 1 skipped in 7:58, against the real Kafka andPostgres testcontainers.
ruff check/ruff formathooks passed on commit.A signature change that broke the caller would have failed mypy and the ingest
tests; both are green.
Notes
internal service constructor signature — no behavior, HTTP API, config, or
dependency change is user-visible.
RUF036(
Nonenot at end of union) atsrc/ook/cli.py:63, which is present onmainand untouched here.