Skip to content

Commit

Permalink
[pyflakes] Ignore submodule_imports in F823
Browse files Browse the repository at this point in the history
  • Loading branch information
gpilikin committed Oct 29, 2024
1 parent 1dea0e6 commit 939492a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::string::ToString;
use ruff_diagnostics::{Diagnostic, Violation};
use ruff_macros::{derive_message_formats, violation};
use ruff_python_semantic::{Scope, ScopeId};
use ruff_python_semantic::BindingKind::SubmoduleImport;
use ruff_text_size::Ranged;

use crate::checkers::ast::Checker;
Expand Down Expand Up @@ -61,7 +62,12 @@ pub(crate) fn undefined_local(
if let Some(range) = shadowed.references().find_map(|reference_id| {
let reference = checker.semantic().reference(reference_id);
if reference.scope_id() == scope_id {
Some(reference.range())
// FIXME: ignore submodules
if let SubmoduleImport(..) = shadowed.kind {
None
} else {
Some(reference.range())
}
} else {
None
}
Expand Down

0 comments on commit 939492a

Please sign in to comment.