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

Bug related to isort:skip usage followed by a comment block #1156

Closed
ljades opened this issue Feb 20, 2020 · 1 comment
Closed

Bug related to isort:skip usage followed by a comment block #1156

ljades opened this issue Feb 20, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@ljades
Copy link

ljades commented Feb 20, 2020

There is a strange bug with isort happening during a very specific type of use case, steps to reproduce:

  1. An import at the top of a module is separated from the rest of the module, and an # isort: skip is used to ignore grouping on it.
  2. A comment block follows this ignored import.
  3. An import is introduced, specifically with a from keyword
  4. Another import in the same group follows.

Example:

from top_level_ignored import config  # isort:skip
####################################
# COMMENT BLOCK SEPARATING THESE   #
####################################
from ast import excepthandler
import logging

The case above yields the following isort error:

 from top_level_ignored import config  # isort:skip
+
 ####################################
 # COMMENT BLOCK SEPARATING THESE   #
 ####################################

When you add the extra line, however, isort still errors asking for another new line. And it just keeps going.

This is strangely idiosyncratic because:

  • If the comment block is not there, it functions properly.
  • If an import is introduced without from (import ast), it functions properly.
  • If there isn't another following import in the same group, it functions properly.
@timothycrosley timothycrosley added the bug Something isn't working label Jul 4, 2020
timothycrosley added a commit that referenced this issue Jul 17, 2020
@timothycrosley
Copy link
Member

Thanks for reporting! This is fixed in release 5.1.2

~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

No branches or pull requests

2 participants