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

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

Merged
merged 1 commit into from Apr 2, 2024

Conversation

charliermarsh
Copy link
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
@@ -66,7 +66,7 @@ pub(crate) fn unconventional_import_alias(
let expected_alias = conventions.get(qualified_name.as_str())?;

let name = binding.name(checker.locator());
if binding.is_alias() && name == expected_alias {
if name == expected_alias {
Copy link
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.)

Copy link

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
17 checks passed
@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