-
-
Save erik-krogh/78a9e543a3543dc98c29fb7afb1fda2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @name Using exists instead of any | |
* @description TODO | |
* @kind problem | |
* @problem.severity warning | |
* @id ql/exists-instead-of-any | |
* @precision high | |
*/ | |
import ql | |
from Exists ex, ComparisonFormula comp, AstNode operand | |
where | |
count(ex.getArgument(_)) = 1 and | |
exists(ex.getRange()) and | |
not exists(ex.getFormula()) and | |
comp = ex.getRange() and | |
comp.getOperator() = "=" and | |
comp.getAnOperand().(VarAccess).getDeclaration() = ex.getArgument(0) and | |
not operand.(VarAccess).getDeclaration() = ex.getArgument(0) and | |
operand = comp.getAnOperand() and | |
count(VarAccess access | access.getDeclaration() = ex.getArgument(0)) = 1 | |
select ex, "This exists can be simplfied an any(..)." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment