-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pycodestyle
] Add fix for multiple-imports-on-one-line
(E401
)
#9518
Merged
charliermarsh
merged 8 commits into
astral-sh:main
from
diceroll123:add-autofix-for-E401
Jan 21, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
529ff76
[`pycodestyle`] - add autofix for `multiple_imports_on_one_line` (`E4…
diceroll123 0477953
add new test cases
diceroll123 0feff07
Merge branch 'main' into add-autofix-for-E401
charliermarsh dc1b770
Wip
charliermarsh f55a583
Merge branch 'main' into add-autofix-for-E401
charliermarsh 096c352
Fix single-line
charliermarsh 6302c86
Fix clippy
charliermarsh 92df930
Fix clippy
diceroll123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
60 changes: 44 additions & 16 deletions
60
.../src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E402_E40.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,32 +1,60 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs | ||
--- | ||
E40.py:55:1: E402 Module level import not at top of file | ||
E40.py:56:1: E402 Module level import not at top of file | ||
| | ||
53 | VERSION = '1.2.3' | ||
54 | | ||
55 | import foo | ||
54 | VERSION = '1.2.3' | ||
55 | | ||
56 | import foo | ||
| ^^^^^^^^^^ E402 | ||
56 | #: E402 | ||
57 | import foo | ||
57 | #: E402 | ||
58 | import foo | ||
| | ||
|
||
E40.py:57:1: E402 Module level import not at top of file | ||
E40.py:58:1: E402 Module level import not at top of file | ||
| | ||
55 | import foo | ||
56 | #: E402 | ||
57 | import foo | ||
56 | import foo | ||
57 | #: E402 | ||
58 | import foo | ||
| ^^^^^^^^^^ E402 | ||
58 | | ||
59 | a = 1 | ||
59 | | ||
60 | a = 1 | ||
| | ||
|
||
E40.py:61:1: E402 Module level import not at top of file | ||
E40.py:62:1: E402 Module level import not at top of file | ||
| | ||
59 | a = 1 | ||
60 | | ||
61 | import bar | ||
60 | a = 1 | ||
61 | | ||
62 | import bar | ||
| ^^^^^^^^^^ E402 | ||
63 | | ||
64 | #: E401 | ||
| | ||
|
||
E40.py:65:1: E402 Module level import not at top of file | ||
| | ||
64 | #: E401 | ||
65 | import re as regex, string # also with a comment! | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ E402 | ||
66 | import re as regex, string; x = 1 | ||
| | ||
|
||
E40.py:66:1: E402 Module level import not at top of file | ||
| | ||
64 | #: E401 | ||
65 | import re as regex, string # also with a comment! | ||
66 | import re as regex, string; x = 1 | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ E402 | ||
67 | | ||
68 | x = 1; import re as regex, string | ||
| | ||
|
||
E40.py:68:8: E402 Module level import not at top of file | ||
| | ||
66 | import re as regex, string; x = 1 | ||
67 | | ||
68 | x = 1; import re as regex, string | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ E402 | ||
| | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diceroll123 - I decided to just
;
-join these for now, since it's hard to know if we're allowed to split them.