mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
[unconventional-import-alias
] Fix infinite loop between ICN001 and I002 (ICN001
) (#15480)
## Summary This fixes the infinite loop reported in #14389 by raising an error to the user about conflicting ICN001 (`unconventional-import-alias`) and I002 (`missing-required-import`) configuration options. ## Test Plan Added a CLI integration test reproducing the old behavior and then confirming the fix. Closes #14389 --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
ca3b210f2e
commit
e2da33a45c
4 changed files with 93 additions and 12 deletions
|
@ -57,7 +57,7 @@ impl NameImport {
|
|||
}
|
||||
|
||||
/// Returns the [`QualifiedName`] of the imported name (e.g., given `from foo import bar as baz`, returns `["foo", "bar"]`).
|
||||
fn qualified_name(&self) -> QualifiedName {
|
||||
pub fn qualified_name(&self) -> QualifiedName {
|
||||
match self {
|
||||
NameImport::Import(import) => QualifiedName::user_defined(&import.name.name),
|
||||
NameImport::ImportFrom(import_from) => collect_import_from_member(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue