Skip to content
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

Divergent isort I001 sort order #2604

Closed
moritz89 opened this issue Feb 6, 2023 · 2 comments
Closed

Divergent isort I001 sort order #2604

moritz89 opened this issue Feb 6, 2023 · 2 comments

Comments

@moritz89
Copy link

moritz89 commented Feb 6, 2023

Ruff reports an error with the following code even though the imports were sorted with isort.

# test.py
from json import decoder
from json import encoder as j_encoder
from json import tool

jdec = decoder.JSONDecoder()
jenv = j_encoder.JSONEncoder()
tool.main()
ruff test.py --select I --isolated

test.py:1:1: I001 Import block is un-sorted or un-formatted
Found 1 error.
1 potentially fixable with the --fix option.

ruff --version
ruff 0.0.239

The order that ruff expects instead is:

# test.py
from json import decoder, tool
from json import encoder as j_encoder

jdec = decoder.JSONDecoder()
jenv = j_encoder.JSONEncoder()
tool.main()
@ngnpope
Copy link
Contributor

ngnpope commented Feb 6, 2023

This is a documented divergence from isort, notably the link to #1381.

@charliermarsh
Copy link
Member

Yeah just closing as a dupe. Appreciate the clear issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants