Skip to content

unconventional-import-alias (ICN001) always flags imports without an as clause #10599

@bardiharborow

Description

@bardiharborow

Currently unconventional-import-alias (ICN001) will always flag imports without an as clause, even if the conventional alias is the same as the module name:

[tool.ruff.lint.flake8-import-conventions.aliases]
"django.conf.settings" = "settings"
from django.conf import settings  # ICN001 `django.conf.settings` should be imported as `settings`
from django.conf import settings as settings  # No errors

Instead it should detect that the module name matches the conventional alias:

from django.conf import settings  # No errors
from django.conf import settings as settings  # No errors

(Though I realise that another rule may want to simply from django.conf import settings as settings to from django.conf import settings.)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions