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

Reformatting imports with aliases, causes noqa comments of long lines (E501) to be on the wrong line #3168

Closed
zkaddach opened this issue Feb 23, 2023 · 2 comments · Fixed by #3216
Assignees
Labels
bug Something isn't working suppression Related to supression of violations e.g. noqa

Comments

@zkaddach
Copy link

Ruff version: 0.0.252
Ruff command: ruff --fix --isolated --select E501,I001 /path/to/file.py

Reformatting imports with aliases, causes noqa comments of long lines (E501) to be on the wrong line hence raising long line errors.

Before:

from myproject.my_very_long_sub_module_name.my_long_data_models_name.my_model_name import (  # noqa: E501
    MyModel as SomethingElse,
)

After:

from myproject.my_very_long_sub_module_name.my_long_data_models_name.my_model_name import (
    MyModel as SomethingElse,  # noqa: E501
)

PS: This doesn't happen when alias is not used.

@zkaddach zkaddach changed the title Reformatting imports with aliases, causes **noqa comments of long lines (E501)** to be on the wrong line Reformatting imports with aliases, causes noqa comments of long lines (E501) to be on the wrong line Feb 23, 2023
@charliermarsh charliermarsh added bug Something isn't working suppression Related to supression of violations e.g. noqa labels Feb 23, 2023
@charliermarsh charliermarsh self-assigned this Feb 24, 2023
@charliermarsh
Copy link
Member

Will take a look today, thanks for filing.

@charliermarsh
Copy link
Member

Def a bug, will require some refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working suppression Related to supression of violations e.g. noqa
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants