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

No NOQA added to long line with as import for multi_line_output = 7 #2093

Open
ruestefa opened this issue Feb 14, 2023 · 0 comments
Open

No NOQA added to long line with as import for multi_line_output = 7 #2093

ruestefa opened this issue Feb 14, 2023 · 0 comments

Comments

@ruestefa
Copy link

ruestefa commented Feb 14, 2023

Summary

With force_single_line = true and multi_line_output = 7, single-import lines that are too long should receive a # NOQA comment (unless there's one already). This doesn't work for as imports (though at least existing # NOQAs are retained).

Versions

Python v3.11.0
isort v5.12.0

Config

# pyproject.toml
[tool.isort]
profile = "black"
force_single_line = true
multi_line_output = 7  # 7-noqa

Input

from some_module import some_function  # type: ignore [import]  # pylint: disable=no-name-in-module
from some_other_module import another_function as yet_another_function  # type: ignore [import]  # pylint: disable=no-name-in-module
from third_module import third_function as wow_three_functions  # type: ignore [import]  # pylint: disable=no-name-in-module  # NOQA

Expected output

from some_module import some_function  # type: ignore [import]  # pylint: disable=no-name-in-module  # NOQA
from some_other_module import another_function as yet_another_function  # type: ignore [import]  # pylint: disable=no-name-in-module  # NOQA
from third_module import third_function as wow_three_functions  # type: ignore [import]  # pylint: disable=no-name-in-module  # NOQA

Actual output

from some_module import some_function  # type: ignore [import]  # pylint: disable=no-name-in-module  # NOQA
from some_other_module import another_function as yet_another_function  # type: ignore [import]  # pylint: disable=no-name-in-module
from third_module import third_function as wow_three_functions  # type: ignore [import]  # pylint: disable=no-name-in-module  # NOQA
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

No branches or pull requests

1 participant