mirror of https://github.com/astral-sh/ruff
Revert "Target the diagnostic at the code even if only one code in comment"
This reverts commit 3c8cd30a35.
This commit is contained in:
parent
9735f0af19
commit
c1101cb04c
|
|
@ -293,12 +293,12 @@ note: This is an unsafe fix and may change runtime behavior
|
||||||
|
|
||||||
|
|
||||||
RUF100 [*] Unused suppression (non-enabled: `E501`)
|
RUF100 [*] Unused suppression (non-enabled: `E501`)
|
||||||
--> suppressions.py:46:21
|
--> suppressions.py:46:5
|
||||||
|
|
|
|
||||||
44 | # Neither of these are ignored and warnings are
|
44 | # Neither of these are ignored and warnings are
|
||||||
45 | # logged to user
|
45 | # logged to user
|
||||||
46 | # ruff: disable[E501]
|
46 | # ruff: disable[E501]
|
||||||
| ^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
47 | I = 1
|
47 | I = 1
|
||||||
48 | # ruff: enable[E501]
|
48 | # ruff: enable[E501]
|
||||||
|
|
|
|
||||||
|
|
@ -313,12 +313,12 @@ help: Remove unused suppression
|
||||||
|
|
||||||
|
|
||||||
RUF100 [*] Unused suppression (non-enabled: `E501`)
|
RUF100 [*] Unused suppression (non-enabled: `E501`)
|
||||||
--> suppressions.py:48:20
|
--> suppressions.py:48:5
|
||||||
|
|
|
|
||||||
46 | # ruff: disable[E501]
|
46 | # ruff: disable[E501]
|
||||||
47 | I = 1
|
47 | I = 1
|
||||||
48 | # ruff: enable[E501]
|
48 | # ruff: enable[E501]
|
||||||
| ^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: Remove unused suppression
|
help: Remove unused suppression
|
||||||
45 | # logged to user
|
45 | # logged to user
|
||||||
|
|
@ -405,12 +405,12 @@ RUF104 Suppression comment without matching `#ruff:enable` comment
|
||||||
|
|
||||||
|
|
||||||
RUF100 [*] Unused suppression (unused: `F841`)
|
RUF100 [*] Unused suppression (unused: `F841`)
|
||||||
--> suppressions.py:69:21
|
--> suppressions.py:69:5
|
||||||
|
|
|
|
||||||
67 | # and the other should trigger an unused suppression diagnostic
|
67 | # and the other should trigger an unused suppression diagnostic
|
||||||
68 | # ruff: disable[F841]
|
68 | # ruff: disable[F841]
|
||||||
69 | # ruff: disable[F841]
|
69 | # ruff: disable[F841]
|
||||||
| ^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
70 | foo = 0
|
70 | foo = 0
|
||||||
|
|
|
|
||||||
help: Remove unused suppression
|
help: Remove unused suppression
|
||||||
|
|
@ -577,12 +577,12 @@ help: Remove unused suppression
|
||||||
|
|
||||||
|
|
||||||
RUF102 [*] Invalid rule code in suppression: YF829
|
RUF102 [*] Invalid rule code in suppression: YF829
|
||||||
--> suppressions.py:93:21
|
--> suppressions.py:93:5
|
||||||
|
|
|
|
||||||
91 | def f():
|
91 | def f():
|
||||||
92 | # Unknown rule codes
|
92 | # Unknown rule codes
|
||||||
93 | # ruff: disable[YF829]
|
93 | # ruff: disable[YF829]
|
||||||
| ^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
94 | # ruff: disable[F841, RQW320]
|
94 | # ruff: disable[F841, RQW320]
|
||||||
95 | value = 0
|
95 | value = 0
|
||||||
|
|
|
|
||||||
|
|
@ -638,12 +638,12 @@ help: Remove the rule code
|
||||||
|
|
||||||
|
|
||||||
RUF102 [*] Invalid rule code in suppression: YF829
|
RUF102 [*] Invalid rule code in suppression: YF829
|
||||||
--> suppressions.py:97:20
|
--> suppressions.py:97:5
|
||||||
|
|
|
|
||||||
95 | value = 0
|
95 | value = 0
|
||||||
96 | # ruff: enable[F841, RQW320]
|
96 | # ruff: enable[F841, RQW320]
|
||||||
97 | # ruff: enable[YF829]
|
97 | # ruff: enable[YF829]
|
||||||
| ^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: Remove the rule code
|
help: Remove the rule code
|
||||||
94 | # ruff: disable[F841, RQW320]
|
94 | # ruff: disable[F841, RQW320]
|
||||||
|
|
@ -656,12 +656,12 @@ help: Remove the rule code
|
||||||
|
|
||||||
|
|
||||||
RUF102 [*] Invalid rule code in suppression: TK421
|
RUF102 [*] Invalid rule code in suppression: TK421
|
||||||
--> suppressions.py:102:21
|
--> suppressions.py:102:5
|
||||||
|
|
|
|
||||||
100 | def f():
|
100 | def f():
|
||||||
101 | # External rule codes should be ignored
|
101 | # External rule codes should be ignored
|
||||||
102 | # ruff: disable[TK421]
|
102 | # ruff: disable[TK421]
|
||||||
| ^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
103 | print("hello")
|
103 | print("hello")
|
||||||
104 | # ruff: enable[TK421]
|
104 | # ruff: enable[TK421]
|
||||||
|
|
|
|
||||||
|
|
@ -675,12 +675,12 @@ help: Remove the rule code
|
||||||
|
|
||||||
|
|
||||||
RUF102 [*] Invalid rule code in suppression: TK421
|
RUF102 [*] Invalid rule code in suppression: TK421
|
||||||
--> suppressions.py:104:20
|
--> suppressions.py:104:5
|
||||||
|
|
|
|
||||||
102 | # ruff: disable[TK421]
|
102 | # ruff: disable[TK421]
|
||||||
103 | print("hello")
|
103 | print("hello")
|
||||||
104 | # ruff: enable[TK421]
|
104 | # ruff: enable[TK421]
|
||||||
| ^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: Remove the rule code
|
help: Remove the rule code
|
||||||
101 | # External rule codes should be ignored
|
101 | # External rule codes should be ignored
|
||||||
|
|
|
||||||
|
|
@ -289,9 +289,8 @@ impl Suppressions {
|
||||||
suppression: &Suppression,
|
suppression: &Suppression,
|
||||||
comment: &SuppressionComment,
|
comment: &SuppressionComment,
|
||||||
) -> (TextRange, Edit) {
|
) -> (TextRange, Edit) {
|
||||||
let range: TextRange;
|
let mut range = comment.range;
|
||||||
let edit = if comment.codes.len() == 1 {
|
let edit = if comment.codes.len() == 1 {
|
||||||
range = comment.codes[0];
|
|
||||||
delete_comment(comment.range, locator)
|
delete_comment(comment.range, locator)
|
||||||
} else {
|
} else {
|
||||||
let code_index = comment
|
let code_index = comment
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue