Skip to content

[ruff] Enable a dozen rules from ruff 0.16 - #14915

Merged
Pierre-Sassoulas merged 3 commits into
pytest-dev:mainfrom
Pierre-Sassoulas:ruff-enable-rules-needing-no-refactor
Aug 27, 2026
Merged

[ruff] Enable a dozen rules from ruff 0.16#14915
Pierre-Sassoulas merged 3 commits into
pytest-dev:mainfrom
Pierre-Sassoulas:ruff-enable-rules-needing-no-refactor

Conversation

@Pierre-Sassoulas

Copy link
Copy Markdown
Member

Follow-up to #14913, manual this time, mostly disabling locally instead of globally.

@Pierre-Sassoulas Pierre-Sassoulas added the skip news used on prs to opt out of the changelog requirement label Aug 19, 2026

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Pierre-Sassoulas

Copy link
Copy Markdown
Member Author

I can't merge this, probably because of the coverage. I'm going to look into it.

Pierre-Sassoulas and others added 2 commits August 27, 2026 08:37
'logging.WARN' is another name for 'logging.WARNING', not a separate level, so
the dict literal listed the same integer key twice and only ever held one of
the two entries. LOG009 pointed this out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The argument is already a tuple, built by unpacking the previous scope, so
wrapping it in 'tuple()' copies it for nothing. C409 pointed this out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Pierre-Sassoulas
Pierre-Sassoulas force-pushed the ruff-enable-rules-needing-no-refactor branch from ef96e72 to f5e9f31 Compare August 27, 2026 06:37
@Pierre-Sassoulas

Copy link
Copy Markdown
Member Author

Thank you for the review, I still can't merge becuase of the coverage, didn't find out why and I didn't find a way to upgrade the coverage easily either. (will work on it later unless you think of an easy solution)

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

codecov is a utter mess

intentionally put a pragma no cover on it - as far as i can tell its never to be invoked, only to be assessed in the helper

FA102, N999, PGH005, PTH210, S112, LOG009 and the source half of C409 need no
change now that the two problems they found are fixed. The remaining four only
need a one-line exemption, because the violation is the thing under test:
SIM202 on the 'approx' operator overloading check, SIM222 and SIM223 in the
assertion rewriting tests, C409 where 'tuple([1, 2])' deliberately builds two
equal but distinct tuples ('assert v1 is not v2' on the next line).

Every exemption is a 'noqa' on the offending line rather than an entry in
'lint.ignore' or 'per-file-ignores', so the rules keep applying to the rest of
those files.

Exclude never-invoked assert helpers from coverage

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Pierre-Sassoulas
Pierre-Sassoulas force-pushed the ruff-enable-rules-needing-no-refactor branch from cc2b17e to 2c26a46 Compare August 27, 2026 15:12
@Pierre-Sassoulas
Pierre-Sassoulas merged commit 814d3da into pytest-dev:main Aug 27, 2026
36 checks passed
@Pierre-Sassoulas
Pierre-Sassoulas deleted the ruff-enable-rules-needing-no-refactor branch August 27, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news used on prs to opt out of the changelog requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants