mirror of https://github.com/astral-sh/ruff
Fix false positive for `IfTuple` (#96)
This commit is contained in:
parent
97cc30768d
commit
e2f46537fd
|
|
@ -6,3 +6,5 @@ for _ in range(5):
|
|||
pass
|
||||
elif (3, 4):
|
||||
pass
|
||||
elif ():
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -241,11 +241,13 @@ impl Visitor for Checker<'_> {
|
|||
}
|
||||
StmtKind::If { test, .. } => {
|
||||
if self.settings.select.contains(CheckKind::IfTuple.code()) {
|
||||
if let ExprKind::Tuple { .. } = test.node {
|
||||
self.checks.push(Check {
|
||||
kind: CheckKind::IfTuple,
|
||||
location: stmt.location,
|
||||
});
|
||||
if let ExprKind::Tuple { elts, .. } = &test.node {
|
||||
if !elts.is_empty() {
|
||||
self.checks.push(Check {
|
||||
kind: CheckKind::IfTuple,
|
||||
location: stmt.location,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue