-
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.
Preserve trailing inline comments on import-from statements
- Loading branch information
1 parent
928ffd6
commit 7100ca0
Showing
8 changed files
with
97 additions
and
7 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
crates/ruff_linter/resources/test/fixtures/isort/trailing_comment.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,13 @@ | ||
from mylib import ( | ||
MyClient, | ||
MyMgmtClient, | ||
) # some comment | ||
|
||
pass | ||
|
||
from mylib import ( | ||
MyClient, | ||
MyMgmtClient, | ||
); from foo import ( | ||
bar | ||
)# some comment |
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
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
30 changes: 30 additions & 0 deletions
30
...nter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.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,30 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/isort/mod.rs | ||
--- | ||
trailing_comment.py:8:1: I001 [*] Import block is un-sorted or un-formatted | ||
| | ||
6 | pass | ||
7 | | ||
8 | / from mylib import ( | ||
9 | | MyClient, | ||
10 | | MyMgmtClient, | ||
11 | | ); from foo import ( | ||
12 | | bar | ||
13 | | )# some comment | ||
| | ||
= help: Organize imports | ||
|
||
ℹ Safe fix | ||
5 5 | | ||
6 6 | pass | ||
7 7 | | ||
8 |+from foo import ( | ||
9 |+ bar, | ||
10 |+) # some comment | ||
8 11 | from mylib import ( | ||
9 12 | MyClient, | ||
10 13 | MyMgmtClient, | ||
11 |-); from foo import ( | ||
12 |- bar | ||
13 |-)# some comment | ||
14 |+) |
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