Update csharp/ql/src/Bad Practices/Control-Flow/ConstantCondition.ql

Co-authored-by: Tom Hvitved <hvitved@github.com>
This commit is contained in:
Michael Nebel
2025-03-12 11:13:25 +01:00
committed by GitHub
parent 371a72ecec
commit 42f86a8234

View File

@@ -119,14 +119,14 @@ class ConstantMatchingCondition extends ConstantCondition {
}
override predicate isWhiteListed() {
exists(Switch se, Case c, int i | c = se.getCase(i) |
c.getPattern() = this.(DiscardExpr) and
(
i > 0
or
i = 0 and
exists(Expr cond | c.getCondition() = cond and not isConstantCondition(cond, true))
)
exists(Switch se, Case c, int i |
c = se.getCase(i) and
c.getPattern() = this.(DiscardExpr)
|
i > 0
or
i = 0 and
exists(Expr cond | c.getCondition() = cond and not isConstantCondition(cond, true))
)
or
this = any(PositionalPatternExpr ppe).getPattern(_)