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

isort ignores reverse_sort when force_sort_within_sections is true #1726

Closed
456dev opened this issue May 9, 2021 · 0 comments · Fixed by #1727
Closed

isort ignores reverse_sort when force_sort_within_sections is true #1726

456dev opened this issue May 9, 2021 · 0 comments · Fixed by #1727

Comments

@456dev
Copy link

456dev commented May 9, 2021

i have a mix of imports that i want sorted by length, and running isort on it while force_sort_within_sections and reverse_sort are both true causes them to be sorted shortest line to longest, rather than longest to shortest, as expected.

pyproject.toml

[tool.isort]
length_sort = true
reverse_sort = true
force_sort_within_sections = true

IN

import blaaa
from bl4aaaaaaaaaaaaaaaa import r
import blaaaaaaaaaaaa
import bla
import blaaaaaaa
from bl1aaaaaaaaaaaaaa import this_is_1
from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2
from bl3aaaaaa import less

OUT

import bla
import blaaa
import blaaaaaaa
import blaaaaaaaaaaaa
from bl3aaaaaa import less
from bl4aaaaaaaaaaaaaaaa import r
from bl1aaaaaaaaaaaaaa import this_is_1
from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2

EXPECTED

from bl2aaaaaaa import THIIIIIIIIIIIISS_is_2
from bl1aaaaaaaaaaaaaa import this_is_1
from bl4aaaaaaaaaaaaaaaa import r
from bl3aaaaaa import less
import blaaaaaaaaaaaa
import blaaaaaaa
import blaaa
import bla
This was referenced Jun 21, 2021
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

Successfully merging a pull request may close this issue.

1 participant