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 no-lines-before incorrect in presence of preceding empty sections #3138

Closed
bluetech opened this issue Feb 22, 2023 · 0 comments · Fixed by #3139
Closed

isort no-lines-before incorrect in presence of preceding empty sections #3138

bluetech opened this issue Feb 22, 2023 · 0 comments · Fixed by #3139

Comments

@bluetech
Copy link
Contributor

Version: 0.0.251

Consider imports such as

from __future__ import print  # future
from django import db         # third-party
from . import y               # local-folder

and isort config no-lines-before = ["local-folder"].

Expected behavior is:

from __future__ import print  # future

from django import db         # third-party

from . import y               # local-folder

Even though we specified no lines before local-folder, there should still be a line before in this case, because the first-party section which comes between local-folder and third-party isn't included in no-lines-before. This is what isort does.

Actual behavior:

from __future__ import print  # future

from django import db         # third-party
from . import y               # local-folder
bluetech added a commit to bluetech/ruff that referenced this issue Feb 22, 2023
charliermarsh pushed a commit that referenced this issue Feb 22, 2023
Fix isort no-lines-before preceded by an empty section

Fix #3138.
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