Skip to content

fix: sort_reexports should respect isort: skip comment (#2569)#2570

Open
muhamedfazalps wants to merge 1 commit into
PyCQA:mainfrom
muhamedfazalps:fix/sort-reexports-skip
Open

fix: sort_reexports should respect isort: skip comment (#2569)#2570
muhamedfazalps wants to merge 1 commit into
PyCQA:mainfrom
muhamedfazalps:fix/sort-reexports-skip

Conversation

@muhamedfazalps

Copy link
Copy Markdown

Fixes #2569

When sort_reexports is enabled, all assignments with # isort: skip comments were still being sorted because the skip comment was not checked before processing.

When sort_reexports is enabled, __all__ assignments with
# isort: skip were still being sorted. Added check for
isort: skip comment before processing re-exports.

Signed-off-by: Muhamed Fazal PS <fazaleee123cr7@gmail.com>
Comment thread isort/core.py
code_sorting_indent = line[: -len(line.lstrip())]
not_imports = True
elif config.sort_reexports and stripped_line.startswith("__all__"):
elif config.sort_reexports and stripped_line.startswith("__all__") and "isort: skip" not in stripped_line:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a test to reproduce the issue?

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 this pull request may close these issues.

sort_reexports does not respect isort: skip

2 participants