-
Notifications
You must be signed in to change notification settings - Fork 83
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
Removing import resorts imports in a way incompatible with isort #229
Comments
isort version: 5.12.0 |
Hmm autoflake should probably not sort anything, just remove the unused ones. Thanks for reporting! |
fsouza
added a commit
that referenced
this issue
Mar 10, 2023
When removing unused imports or breaking up lines, keep the original order. Users can use other linters/formatters to fix import order (e.g. isort or reorder-python-imports). Closes #229.
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
isort sorts ALL_CAPS objects before other objects, while autoflake sorts purely lexically after removing an unused import object from a
from ... import ...
line - which causes discrepancies and means isort has to be run after autoflake in CI's.Example:
initial file
first line after running autoflake
which then gets modified if we run isort afterwards
I suggest this be solved either by adhering to isort's sorting order when removing an import - or not resorting the import objects at all when removing and entirely leaving that up to isort.
The text was updated successfully, but these errors were encountered: