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

noqa comments for N812 don't apply to the correct line in multi-line imports #3763

Closed
ehdr opened this issue Mar 27, 2023 · 2 comments · Fixed by #3772
Closed

noqa comments for N812 don't apply to the correct line in multi-line imports #3763

ehdr opened this issue Mar 27, 2023 · 2 comments · Fixed by #3772
Assignees
Labels
bug Something isn't working

Comments

@ehdr
Copy link

ehdr commented Mar 27, 2023

When trying to apply a noqa comment for rule N812 (lowercase-imported-as-non-lowercase) on a multi-line import, it does not seem to apply to the correct line. For example, I would expect the following to not flag any errors:

from mod import (
    lower_case as NonLowerCase,  # noqa: F401, N812
)

but it gives

n812.py:1:1: N812 Lowercase `lower_case` imported as non-lowercase `NonLowerCase`
n812.py:2:34: RUF100 [*] Unused `noqa` directive (unused: `N812`)
Found 2 errors.

The following however gives no errors:

from mod import (  # noqa: N812
    lower_case as NonLowerCase,  # noqa: F401
)
@charliermarsh
Copy link
Member

Thanks! Will go out in the next release. (Either version will work.)

@ehdr
Copy link
Author

ehdr commented Mar 28, 2023

Lightning fast as always! Thank you! 🙏

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