-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6276b05
commit b0bc967
Showing
5 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
crates/ruff_linter/resources/test/fixtures/isort/required_imports/unused.py
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Unused, but marked as required. | ||
import os | ||
|
||
# Unused, _not_ marked as required. | ||
import sys | ||
|
||
# Unused, _not_ marked as required (due to the alias). | ||
import pathlib as non_alias | ||
|
||
# Unused, marked as required. | ||
import shelve as alias | ||
|
||
# Unused, but marked as required. | ||
from typing import List | ||
|
||
# Unused, but marked as required. | ||
from typing import Set as SetAlias | ||
|
||
# Unused, but marked as required. | ||
import urllib.parse |
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
40 changes: 40 additions & 0 deletions
40
...rc/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_unused.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/isort/mod.rs | ||
--- | ||
unused.py:5:8: F401 [*] `sys` imported but unused | ||
| | ||
4 | # Unused, _not_ marked as required. | ||
5 | import sys | ||
| ^^^ F401 | ||
6 | | ||
7 | # Unused, _not_ marked as required (due to the alias). | ||
| | ||
= help: Remove unused import: `sys` | ||
|
||
ℹ Safe fix | ||
2 2 | import os | ||
3 3 | | ||
4 4 | # Unused, _not_ marked as required. | ||
5 |-import sys | ||
6 5 | | ||
7 6 | # Unused, _not_ marked as required (due to the alias). | ||
8 7 | import pathlib as non_alias | ||
|
||
unused.py:8:19: F401 [*] `pathlib` imported but unused | ||
| | ||
7 | # Unused, _not_ marked as required (due to the alias). | ||
8 | import pathlib as non_alias | ||
| ^^^^^^^^^ F401 | ||
9 | | ||
10 | # Unused, marked as required. | ||
| | ||
= help: Remove unused import: `pathlib` | ||
|
||
ℹ Safe fix | ||
5 5 | import sys | ||
6 6 | | ||
7 7 | # Unused, _not_ marked as required (due to the alias). | ||
8 |-import pathlib as non_alias | ||
9 8 | | ||
10 9 | # Unused, marked as required. | ||
11 10 | import shelve as alias |
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