-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[pycodestyle
] Add fix for multiple-imports-on-one-line
(E401
)
#9518
Conversation
7b3b35e
to
69f71d2
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
E401 | 2 | 0 | 0 | 2 | 0 |
diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( | ||
replacement, | ||
stmt.range(), | ||
))); |
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.
Can you add test cases for, e.g.:
x = 1; import re as regex, string
import re as regex, string; x = 1
CodSpeed Performance ReportMerging #9518 will not alter performanceComparing Summary
|
b387a6e
to
0477953
Compare
pycodestyle
] - add fix for multiple_imports_on_one_line
(E401
)pycodestyle
] Add fix for multiple-imports-on-one-line
(E401
)
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.
Thanks! I had to apply some changes to fix cases like: if True: import re as regex, string
}) | ||
.join("; "); | ||
|
||
Fix::safe_edit(Edit::range_replacement(replacement, stmt.range())) |
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.
Head branch was pushed to by a user without write access
Summary
Add autofix for
multiple_imports_on_one_line
,E401
Test Plan
cargo test