Skip to content

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

@ehdr

Description

@ehdr

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
)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions