Skip to content

Allow suppressing RUF102#23236

Closed
amyreese wants to merge 1 commit intomainfrom
amy/suppress-RUF102
Closed

Allow suppressing RUF102#23236
amyreese wants to merge 1 commit intomainfrom
amy/suppress-RUF102

Conversation

@amyreese
Copy link
Member

Check to see if any of the valid codes are RUF102 and suppress itself.

Fixes #23191

@amyreese amyreese requested a review from ntBre February 11, 2026 19:49
@amyreese amyreese force-pushed the amy/suppress-RUF102 branch from d4e4b3b to fe7e8c1 Compare February 11, 2026 19:53
@amyreese amyreese changed the base branch from main to amy/unused-ruf10x February 11, 2026 19:53
@amyreese amyreese added the suppression Related to supression of violations e.g. noqa label Feb 11, 2026
Check to see if any of the valid codes are RUF102 and suppress itself.

Fixes #23191
@amyreese amyreese force-pushed the amy/suppress-RUF102 branch from fe7e8c1 to 0f29786 Compare February 11, 2026 20:06
@amyreese amyreese changed the base branch from amy/unused-ruf10x to main February 11, 2026 20:06
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 11, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@amyreese amyreese force-pushed the amy/suppress-RUF102 branch from 0f29786 to 7e09ac5 Compare February 11, 2026 20:08
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

Thanks, this makes sense to me and seems similar to what we do for RUF100. Should we add a test or two?

@amyreese
Copy link
Member Author

amyreese commented Feb 12, 2026

The main concern for me is that without #23237 then any # noqa: RUF102 will permanently also raise a RUF100 diagnostic, forcing users to do # noqa: RUF100, RUF102.

@ntBre
Copy link
Contributor

ntBre commented Feb 12, 2026

Okay, I think I'm understanding better. It makes sense to me to make RUF100 and RUF102 know about each other, much like the changes for RUF100 itself in #1305, which I think are essentially how we avoid this for RUF100 now. Can we just do this for RUF100 and RUF102? Why do the other RUF10 rules need to be marked as used too?

I think some tests would help me in any case. I'm having trouble keeping all the conditions straight with the context spread out as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

suppression Related to supression of violations e.g. noqa

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to in-line suppress RUF102

2 participants