Skip to content

Accept non-aliased (but correct) import in unconventional-import-alias#10729

Merged
charliermarsh merged 1 commit intomainfrom
charlie/inc
Apr 2, 2024
Merged

Accept non-aliased (but correct) import in unconventional-import-alias#10729
charliermarsh merged 1 commit intomainfrom
charlie/inc

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

Given:

[tool.ruff.lint.flake8-import-conventions.aliases]
"django.conf.settings" = "settings"

We should accept from django.conf import settings.

Closes #10599.

@charliermarsh charliermarsh added the bug Something isn't working label Apr 2, 2024

let name = binding.name(checker.locator());
if binding.is_alias() && name == expected_alias {
if name == expected_alias {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This is the fix.)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh merged commit 159bad7 into main Apr 2, 2024
@charliermarsh charliermarsh deleted the charlie/inc branch April 2, 2024 03:47
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 this pull request may close these issues.

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

1 participant