Allow human-readable names in suppression comments#25614
Draft
ntBre wants to merge 4 commits into
Draft
Conversation
ntBre
commented
Jun 3, 2026
| settings.preview.is_enabled() | ||
| } | ||
|
|
||
| // https://github.com/astral-sh/ruff/pull/TODO |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| // https://github.com/astral-sh/ruff/pull/TODO | |
| // https://github.com/astral-sh/ruff/pull/25614 |
|
ntBre
added a commit
that referenced
this pull request
Jun 5, 2026
Summary -- From what I can tell, there's not really an easy way to preview-gate this. I don't think we have access to configuration in this subcommand, and it doesn't seem easy to pass it to clap even if we had it. However, I don't think there's much downside to being more permissive here and allowing this even before other human-readable names work. This is currently stacked on #25614, but it just needs the `FromStr` derived by the strum macro. Test Plan -- New CLI test
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.
Summary
I decided to start trying to break up #23701, and this looked like the easiest first piece. This PR allows using human-readable rule names in the new
ruff:ignoreand similar suppression comments, in preview.Rule names are still disallowed in
noqacomments, and rule codes are still allowed inruff:ignorecomments.I did notice one surprising property here in that a
noqacomment with a rule name does not emit invalid-rule-code (RUF102), even on main. This seems to be an artifact of ournoqaparsing:ruff/crates/ruff_linter/src/noqa.rs
Lines 555 to 562 in f1d2b65
that we may also want to consider updating now.
Test Plan
New mdtests