-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rulesuppressionRelated to supression of violations e.g. noqaRelated to supression of violations e.g. noqa
Description
Summary
If a range suppression has more than one unused code, ruff will produce a separate diagnostic for each unused code, rather than grouping them into a single diagnostic like will happen for unused noqa:
$ cat ~/scratch/ruff/foo.py
# ruff: disable[F401, F501]
print("hello") # noqa: F401 F501
$ cargo run -p ruff -- check --no-cache --isolated --preview --select F,RUF100 ~/scratch/ruff/foo.py
RUF100 [*] Unused suppression (unused: `F401`)
--> /Users/amethyst/scratch/ruff/foo.py:1:17
|
1 | # ruff: disable[F401, F501]
| ^^^^
2 | print("hello") # noqa: F401 F501
|
help: Remove unused suppression
- # ruff: disable[F401, F501]
1 + # ruff: disable[F501]
2 | print("hello") # noqa: F401 F501
3 |
RUF100 [*] Unused suppression (unused: `F501`)
--> /Users/amethyst/scratch/ruff/foo.py:1:23
|
1 | # ruff: disable[F401, F501]
| ^^^^
2 | print("hello") # noqa: F401 F501
|
help: Remove unused suppression
- # ruff: disable[F401, F501]
1 + # ruff: disable[F401]
2 | print("hello") # noqa: F401 F501
3 |
RUF100 [*] Unused `noqa` directive (unused: `F401`, `F501`)
--> /Users/amethyst/scratch/ruff/foo.py:2:17
|
1 | # ruff: disable[F401, F501]
2 | print("hello") # noqa: F401 F501
| ^^^^^^^^^^^^^^^^^
|
help: Remove unused `noqa` directive
1 | # ruff: disable[F401, F501]
- print("hello") # noqa: F401 F501
2 + print("hello")
3 |
Found 3 errors.
[*] 3 fixable with the `--fix` option.
> [1]
Version
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rulesuppressionRelated to supression of violations e.g. noqaRelated to supression of violations e.g. noqa