8000 ruby: remove redundant cases · github/codeql@f675a14 · GitHub
[go: up one dir, main page]

Skip to content

Commit f675a14

Browse files
committed
ruby: remove redundant cases
The CFG handles the negation
1 parent 8555e8c commit f675a14

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

ruby/ql/src/queries/variables/UninitializedLocal.ql

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,12 @@ predicate isGuarded(LocalVariableReadAccess read) {
3737
guard.getAstNode() = read.getVariable().getAnAccess() and
3838
branch = true
3939
or
40-
// guard is `!var`
41-
guard.getAstNode().(NotExpr).getOperand() = read.getVariable().getAnAccess() and
42-
branch = false
43-
or
4440
// guard is `var.nil?`
4541
exists(MethodCall c | guard.getAstNode() = c |
4642
c.getReceiver() = read.getVariable().getAnAccess() and
4743
c.getMethodName() = "nil?"
4844
) and
4945
branch = false
50-
or
51-
// guard is `!var.nil?`
52-
exists(MethodCall c | guard.getAstNode().(NotExpr).getOperand() = c |
53-
c.getReceiver() = read.getVariable().getAnAccess() and
54-
c.getMethodName() = "nil?"
55-
) and
56-
branch = true
5746
)
5847
}
5948

0 commit comments

Comments
 (0)
0