mirror of https://github.com/astral-sh/ruff
Handle name nodes prior to running rules (#5770)
## Summary This is more consistent with other patterns in the Checker. Shouldn't change behavior at all.
This commit is contained in:
parent
086f8a3c12
commit
bf248ede93
|
|
@ -2271,6 +2271,8 @@ where
|
||||||
Expr::Name(ast::ExprName { id, ctx, range: _ }) => {
|
Expr::Name(ast::ExprName { id, ctx, range: _ }) => {
|
||||||
match ctx {
|
match ctx {
|
||||||
ExprContext::Load => {
|
ExprContext::Load => {
|
||||||
|
self.handle_node_load(expr);
|
||||||
|
|
||||||
if self.enabled(Rule::TypingTextStrAlias) {
|
if self.enabled(Rule::TypingTextStrAlias) {
|
||||||
pyupgrade::rules::typing_text_str_alias(self, expr);
|
pyupgrade::rules::typing_text_str_alias(self, expr);
|
||||||
}
|
}
|
||||||
|
|
@ -2324,10 +2326,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.handle_node_load(expr);
|
|
||||||
}
|
}
|
||||||
ExprContext::Store => {
|
ExprContext::Store => {
|
||||||
|
self.handle_node_store(id, expr);
|
||||||
|
|
||||||
if self.enabled(Rule::AmbiguousVariableName) {
|
if self.enabled(Rule::AmbiguousVariableName) {
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
pycodestyle::rules::ambiguous_variable_name(id, expr.range())
|
pycodestyle::rules::ambiguous_variable_name(id, expr.range())
|
||||||
|
|
@ -2354,8 +2356,6 @@ where
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.handle_node_store(id, expr);
|
|
||||||
}
|
}
|
||||||
ExprContext::Del => self.handle_node_delete(expr),
|
ExprContext::Del => self.handle_node_delete(expr),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue