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] force-sort-within-sections and lines-between-types should probably be incompatible #8792

Closed
bluthej opened this issue Nov 20, 2023 · 0 comments · Fixed by #9041
Closed
Assignees
Labels
bug Something isn't working isort Related to import sorting

Comments

@bluthej
Copy link
Contributor

bluthej commented Nov 20, 2023

Current behavior

When setting force-sort-within-sections to true and lines-between-types to 1, Ruff adds a blank line before the first from import that appears after a straight import.

(Presumably) desired behavior

isort does not add blank lines in this situation, which I think makes sense, so I propose to stick to that behavior. I guess the force-sort-within-sections setting should simply override the lines-between-types setting.

Example

I tested isort with force_sort_within_sections and lines_between_types = 1 against the following example:

from a import x
import b
from c import y
import d

and it doesn't do anything. Here is the command I ran (isort version 5.12.0):

isort --fss --lbt 1 --stdout example.py

However, running cargo r -p ruff_cli -- check example.py --no-cache --diff adds a blank line after import b with the following config:

select = ["I001"]

[isort]
force-sort-within-sections = true
lines-between-types = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working isort Related to import sorting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants