Files
codeql/java/ql/examples/snippets/eq_true.ql
Chris Smowton f95effcf82 Always extract ValueEQ/NEExpr for Kotlin ==/!=
I introduce AnyEqualsExpr for either reference or value equality and AnyEqualityTest for the same concept including not-equals operators, and use them wherever the written QL clearly doesn't care about the difference between reference and value comparison, typically because it is concerned with testing against null or against a primitive constant.
2022-05-10 19:51:17 +01:00

15 lines
290 B
Plaintext

/**
* @id java/examples/eq-true
* @name Equality test on boolean
* @description Finds tests like `==true`, `==false`, `!=true`, `!=false`
* @tags equals
* test
* boolean
*/
import java
from AnyEqualityTest eq
where eq.getAnOperand() instanceof BooleanLiteral
select eq