I'm trying to migrate isort and black to ruff but encountered some problems when using ruff's isort configs.
Ruff version 0.2.1.
Suppose I have a first-party package named package and the test code is:
from package.utils import a
from package.func import function
with the ruff config:
[tool.ruff.lint]
select = ["I"]
[tool.ruff.lint.isort]
length-sort = true
force-sort-within-sections = true
ruff will report import order error and fix it into:
from package.func import function
from package.utils import a
but isort sorts it as the origin test code given above.
I make one more test, renaming the package.func to package.function:
from package.utils import a
from package.function import function
this time ruff does not report any error. It seems ruff sort the import order by module name length instead of import expression length?
I'm trying to migrate isort and black to ruff but encountered some problems when using ruff's isort configs.
Ruff version 0.2.1.
Suppose I have a first-party package named
packageand the test code is:with the ruff config:
ruff will report import order error and fix it into:
but isort sorts it as the origin test code given above.
I make one more test, renaming the
package.functopackage.function:this time ruff does not report any error. It seems ruff sort the import order by module name length instead of import expression length?