-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
isortRelated to import sortingRelated to import sortingquestionAsking for support or clarificationAsking for support or clarification
Description
Hey!
I found what I believe is a little bug with regards to isorts combine-as-imports, as it seems to act contrary to its definition in some cases.
Sample reproduction code:
from json import detect_encoding
from json import dump
from json import dumps as json_dumps
from json import load
from json import loads as json_loadsQuite a bad example of "real world code", but there is a genuine use case behind this. The random imports are for the sake of showing the problem. Note that running isort with profile = "black" and force-single-line = true doesnt change this file
--fix while using combine-as-imports = true
$ ruff ruff_test.py --select I001 --fix
<no output>
$ cat ruff_test.py
from json import detect_encoding
from json import dump
from json import dumps as json_dumps
from json import load
from json import loads as json_loads
--fix while using combine-as-imports = false
$ ruff ruff_test.py --select I001 --fix
Found 1 error (1 fixed, 0 remaining).
$ cat ruff_test.py
from json import detect_encoding
from json import dump
from json import load
from json import dumps as json_dumps
from json import loads as json_loads
Ruff settings:
[tool.ruff]
line-length = 125
target-version = "py38"
select = ["E", "I", "F"]
[tool.ruff.isort]
force-single-line = true
combine-as-imports = true # This line config will be added/removed according to the steps aboveRuff version:
ruff 0.0.255
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
isortRelated to import sortingRelated to import sortingquestionAsking for support or clarificationAsking for support or clarification