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

indent is not preserved when isort:skip is used in nested import #1339

Closed
sergeant-wizard opened this issue Jul 22, 2020 · 1 comment · Fixed by #1340
Closed

indent is not preserved when isort:skip is used in nested import #1339

sergeant-wizard opened this issue Jul 22, 2020 · 1 comment · Fixed by #1340
Labels
bug Something isn't working

Comments

@sergeant-wizard
Copy link
Contributor

sergeant-wizard commented Jul 22, 2020

Hello, love the project.

When running isort version 5.1.4 against the following file

def foo():
    from looooooooooooooooooooooooooooooooong_module import (  # isort:skip
        loooooooooooooooooooooooooooooooooong_name1)

isort suggests to unident the third line:

isort --check --diff tmp2.py
ERROR: tmp2.py Imports are incorrectly sorted and/or formatted.
--- tmp2.py:before        2020-07-22 11:11:29.987441
+++ tmp2.py:after 2020-07-22 11:16:13.352721
@@ -1,3 +1,3 @@
 def foo():
     from looooooooooooooooooooooooooooooooong_module import (  # isort:skip
-        loooooooooooooooooooooooooooooooooong_name1)
+    loooooooooooooooooooooooooooooooooong_name1)

We expected isort to ignore since isort:skip is specified.

Also, isort 4.3.21 will not report any violations for this code.
Running git bisect with this test case got me to this commit as the breaking commit.

The problem seems to be interlaced with the nested situation, as isort does not report violations for the following:

from looooooooooooooooooooooooooooooooong_module import (  # isort:skip
    loooooooooooooooooooooooooooooooooong_name1)

Environment

  • python 3.7.4 (pyenv)
  • ubuntu 18.04
  • isort 5.1.4 (fails) / 4.3.21 (succeeds)
@timothycrosley
Copy link
Member

This was just deployed with version 5.2.0 of isort. Thanks!

~Timothy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants