mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Java/Kotlin: Add a consistency query for BinaryExpr
This commit is contained in:
8
java/ql/consistency-queries/BinaryExpr.ql
Normal file
8
java/ql/consistency-queries/BinaryExpr.ql
Normal file
@@ -0,0 +1,8 @@
|
||||
import java
|
||||
|
||||
from BinaryExpr be, string reason
|
||||
where not exists(be.getLeftOperand()) and reason = "No left operand"
|
||||
or not exists(be.getRightOperand()) and reason = "No right operand"
|
||||
or exists(Expr e, int i | e.isNthChildOf(be, i) and i != 0 and i != 1 and reason = "Unexpected operand " + i.toString())
|
||||
or be.getOp() = " ?? " and reason = "No operator name"
|
||||
select be, reason
|
||||
Reference in New Issue
Block a user