-
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
[isort
] Omit trailing whitespace in unsorted-imports
(I001
)
#15518
base: main
Are you sure you want to change the base?
Conversation
Questions:
|
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
I001 | 10 | 5 | 5 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+5 -5 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)
bokeh/bokeh (+5 -5 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- examples/server/app/gapminder/data.py:5:1: I001 [*] Import block is un-sorted or un-formatted + examples/server/app/gapminder/data.py:5:5: I001 [*] Import block is un-sorted or un-formatted - src/bokeh/model/model.py:46:1: I001 [*] Import block is un-sorted or un-formatted + src/bokeh/model/model.py:46:5: I001 [*] Import block is un-sorted or un-formatted - src/bokeh/model/util.py:167:1: I001 [*] Import block is un-sorted or un-formatted + src/bokeh/model/util.py:167:5: I001 [*] Import block is un-sorted or un-formatted - src/bokeh/server/connection.py:28:1: I001 [*] Import block is un-sorted or un-formatted + src/bokeh/server/connection.py:28:5: I001 [*] Import block is un-sorted or un-formatted - tests/test_cross.py:34:1: I001 [*] Import block is un-sorted or un-formatted + tests/test_cross.py:34:5: I001 [*] Import block is un-sorted or un-formatted
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
I001 | 10 | 5 | 5 | 0 | 0 |
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 kind of liked that the old range included the entire line instead of just the expression range. It would be nice if we can preserve that behavior
@@ -30,7 +30,7 @@ force_single_line.py:1:1: I001 [*] Import block is un-sorted or un-formatted | |||
25 | | | |||
26 | | # comment 9 | |||
27 | | from baz import * # comment 10 |
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.
Not strictly incorrect but I think I liked the old one better
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.
I think I like the new one since it's a little more specific. But I do feel like the old one is more aesthetically pleasing.
@@ -30,7 +30,7 @@ force_single_line.py:1:1: I001 [*] Import block is un-sorted or un-formatted | |||
25 | | | |||
26 | | # comment 9 | |||
27 | | from baz import * # comment 10 |
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.
I think I like the new one since it's a little more specific. But I do feel like the old one is more aesthetically pleasing.
7 | | from my_first_party import my_first_party_object | ||
8 | | | ||
9 | | from . import my_local_folder_object | ||
| |____________________________________^ I001 |
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.
Nice!
| | ||
32 | import sys; import os # isort:skip | ||
33 | import sys; import os # isort:skip # isort:skip | ||
34 | import sys; import os | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ I001 | ||
| ^^^^^^^^^^^^^^^^^^^^^ I001 |
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.
Another nice improvement I think.
Summary
The fix range for sorting imports accounts for trailing whitespace, but we should only show the trimmed range to the user when displaying the diagnostic. So this PR changes the diagnostic range.
Closes #15504
Test Plan
Reviewed snapshot changes