Skip to content

Commit 2f37326

Browse files
committed
ruby: exclude uses that are part of ||
these can safely be uninitialised
1 parent 7bec7ba commit 2f37326

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class RelevantLocalVariableReadAccess extends LocalVariableReadAccess {
1818
not exists(MethodCall c |
1919
c.getReceiver() = this and
2020
c.getMethodName() = "nil?"
21+
) and
22+
not exists(BinaryOperation b |
23+
b.getLeftOperand() = this and
24+
b.getOperator() = "||"
2125
)
2226
}
2327
}

0 commit comments

Comments
 (0)