-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a fix for redefinition-while-unused
- Loading branch information
1 parent
f684175
commit 184f7a3
Showing
20 changed files
with
155 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
7 changes: 6 additions & 1 deletion
7
...ter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_1.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F811_1.py:1:25: F811 Redefinition of unused `FU` from line 1 | ||
F811_1.py:1:25: F811 [*] Redefinition of unused `FU` from line 1 | ||
| | ||
1 | import fu as FU, bar as FU | ||
| ^^ F811 | ||
| | ||
= help: Remove definition: `FU` | ||
|
||
ℹ Unsafe fix | ||
1 |-import fu as FU, bar as FU | ||
1 |+import fu as FU | ||
|
||
|
11 changes: 10 additions & 1 deletion
11
...er/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_12.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F811_12.py:6:20: F811 Redefinition of unused `mixer` from line 2 | ||
F811_12.py:6:20: F811 [*] Redefinition of unused `mixer` from line 2 | ||
| | ||
4 | pass | ||
5 | else: | ||
6 | from bb import mixer | ||
| ^^^^^ F811 | ||
7 | mixer(123) | ||
| | ||
= help: Remove definition: `mixer` | ||
|
||
ℹ Unsafe fix | ||
3 3 | except ImportError: | ||
4 4 | pass | ||
5 5 | else: | ||
6 |- from bb import mixer | ||
6 |+ pass | ||
7 7 | mixer(123) | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ F811_15.py:4:5: F811 Redefinition of unused `fu` from line 1 | |
| ^^ F811 | ||
5 | pass | ||
| | ||
= help: Remove definition: `fu` | ||
|
||
|
This file contains 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
This file contains 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
7 changes: 6 additions & 1 deletion
7
...ter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_2.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F811_2.py:1:34: F811 Redefinition of unused `FU` from line 1 | ||
F811_2.py:1:34: F811 [*] Redefinition of unused `FU` from line 1 | ||
| | ||
1 | from moo import fu as FU, bar as FU | ||
| ^^ F811 | ||
| | ||
= help: Remove definition: `FU` | ||
|
||
ℹ Unsafe fix | ||
1 |-from moo import fu as FU, bar as FU | ||
1 |+from moo import fu as FU | ||
|
||
|
14 changes: 13 additions & 1 deletion
14
...er/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F811_21.py:32:5: F811 Redefinition of unused `Sequence` from line 26 | ||
F811_21.py:32:5: F811 [*] Redefinition of unused `Sequence` from line 26 | ||
| | ||
30 | from typing import ( | ||
31 | List, # noqa: F811 | ||
32 | Sequence, | ||
| ^^^^^^^^ F811 | ||
33 | ) | ||
| | ||
= help: Remove definition: `Sequence` | ||
|
||
ℹ Unsafe fix | ||
29 29 | # This should ignore the first error. | ||
30 30 | from typing import ( | ||
31 31 | List, # noqa: F811 | ||
32 |- Sequence, | ||
33 |-) | ||
32 |+ ) | ||
34 33 | | ||
35 34 | # This should ignore both errors. | ||
36 35 | from typing import ( # noqa | ||
|
||
|
9 changes: 8 additions & 1 deletion
9
...er/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_23.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F811_23.py:4:15: F811 Redefinition of unused `foo` from line 3 | ||
F811_23.py:4:15: F811 [*] Redefinition of unused `foo` from line 3 | ||
| | ||
3 | import foo as foo | ||
4 | import bar as foo | ||
| ^^^ F811 | ||
| | ||
= help: Remove definition: `foo` | ||
|
||
ℹ Unsafe fix | ||
1 1 | """Test that shadowing an explicit re-export produces a warning.""" | ||
2 2 | | ||
3 3 | import foo as foo | ||
4 |-import bar as foo | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
10 changes: 9 additions & 1 deletion
10
...ter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F811_6.py:6:12: F811 Redefinition of unused `os` from line 5 | ||
F811_6.py:6:12: F811 [*] Redefinition of unused `os` from line 5 | ||
| | ||
4 | if i == 1: | ||
5 | import os | ||
6 | import os | ||
| ^^ F811 | ||
7 | os.path | ||
| | ||
= help: Remove definition: `os` | ||
|
||
ℹ Unsafe fix | ||
3 3 | i = 2 | ||
4 4 | if i == 1: | ||
5 5 | import os | ||
6 |- import os | ||
7 6 | os.path | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | |
| ^^ F811 | ||
6 | print(os) | ||
| | ||
= help: Remove definition: `os` | ||
|
||
|
This file contains 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