Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilise redirected-noqa (RUF101) #12869

Merged
merged 2 commits into from
Aug 14, 2024
Merged

Stabilise redirected-noqa (RUF101) #12869

merged 2 commits into from
Aug 14, 2024

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Aug 13, 2024

Summary

Stabilise two one ruff rule for the 0.6 release:

  • missing-f-string-syntax (RUF027)
  • redirected-noqa (RUF101)

These have both been in preview for a while and there are no open issues about either of them. They also both seem like very useful rules.

I'm fixing a tiny oversight in the RUF027 logic as part of this PR, but it's never been reported and it's unlikely to come up.

Test Plan

cargo test -p ruff_linter --lib + ecosystem

Copy link
Contributor

github-actions bot commented Aug 13, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+3 -0 violations, +0 -0 fixes in 3 projects; 51 projects unchanged)

DisnakeDev/disnake (+1 -0 violations, +0 -0 fixes)

+ disnake/utils.py:1161:56: RUF101 [*] `PGH001` is a redirect to `S307`

RasaHQ/rasa (+1 -0 violations, +0 -0 fixes)

+ tests/graph_components/validators/test_default_recipe_validator.py:815:72: RUF101 [*] `RUF011` is a redirect to `B035`

wntrblm/nox (+1 -0 violations, +0 -0 fixes)

+ nox/manifest.py:357:50: RUF101 [*] `PGH001` is a redirect to `S307`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF101 3 3 0 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood
Copy link
Member Author

Most of the RUF027 hits seem to be true positives that I think projects would very much like to know about (so this shows the value of stabilising the rule)... however, this one is a false positive, that I think wouldn't be too hard for us to fix: https://github.com/pytest-dev/pytest/blob/38ad84bafd18d15ceff1960d636c693560337844/src/_pytest/main.py#L1055-L1060

@AlexWaygood
Copy link
Member Author

Okay, this is another false positive: https://github.com/pypa/cibuildwheel/blob/c6dd39bd834ed458bb627c294854832e21971f1a/cibuildwheel/macos.py#L742. The rule should exclude logging calls in the same way that it excludes gettext() calls. In that case, I don't think this rule can be stabilised right now, which is a shame :(

@AlexWaygood AlexWaygood marked this pull request as draft August 13, 2024 18:20
@AlexWaygood AlexWaygood changed the title Stabilise 2 ruff rules Stabilise RUF101 Aug 13, 2024
@AlexWaygood AlexWaygood changed the title Stabilise RUF101 Stabilise redirected-noqa (RUF101) Aug 13, 2024
@AlexWaygood AlexWaygood marked this pull request as ready for review August 13, 2024 22:36
@AlexWaygood
Copy link
Member Author

I've taken the RUF027 stabilisation out of this PR. I'll put up a separate PR to reduce the false positives after the release is out.

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Aug 14, 2024
@AlexWaygood AlexWaygood merged commit b845d58 into ruff-0.6 Aug 14, 2024
20 checks passed
@AlexWaygood AlexWaygood deleted the ruff-stabilisations branch August 14, 2024 08:55
@MichaReiser MichaReiser mentioned this pull request Aug 14, 2024
AlexWaygood added a commit that referenced this pull request Aug 14, 2024
MichaReiser pushed a commit that referenced this pull request Aug 14, 2024
MichaReiser pushed a commit that referenced this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants