mirror of
https://github.com/astral-sh/ruff
synced 2026-01-08 15:14:19 -05:00
Report diagnostics for invalid/unmatched range suppression comments (#21908)
## Summary - Adds new RUF103 and RUF104 diagnostics for invalid and unmatched suppression comments - Reports RUF100 for any unused range suppression - Reports RUF102 for range suppression comment with invalid rule codes - Reports RUF103 for range suppression comment with invalid suppression syntax - Reports RUF104 diagnostics for any unmatched range suppression comment (disable w/o enable) ## Test Plan Updated snapshots from test cases with unmatched suppression comments Issue #3711 Fixes #21878 Fixes #21875
This commit is contained in:
@@ -384,6 +384,9 @@ foo()
|
||||
|
||||
It is strongly suggested to use explicit range suppressions, in order to prevent
|
||||
accidental suppressions of violations, especially at global module scope.
|
||||
For this reason, a `RUF104` diagnostic will also be produced for any implicit range.
|
||||
If implicit range suppressions are desired, the `RUF104` rule can be disabled,
|
||||
or an inline `noqa` suppression can be added to the end of the "disable" comment.
|
||||
|
||||
Range suppressions cannot be used to enable or select rules that aren't already
|
||||
selected by the project configuration or runtime flags. An "enable" comment can only
|
||||
|
||||
Reference in New Issue
Block a user