Skip to content

Commit 09d727f

Browse files
authored
QL: Merge pull request #96 from github/erik-krogh/dont-use-getaqlclass
add query to detect uses of getAQlClass
2 parents b46dfc0 + 5fc1b8b commit 09d727f

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @name Don't use getAQlClass.
3+
* @description Any use of getAQlClass causes both compile-time and runtime to be significantly slower.
4+
* @kind problem
5+
* @problem.severity warning
6+
* @id ql/dont-use-getaqlclass
7+
* @tags performance
8+
* @precision very-high
9+
*/
10+
11+
import ql
12+
13+
from Call call
14+
where
15+
(
16+
call.(PredicateCall).getPredicateName() = "getAQlClass" or
17+
call.(MemberCall).getMemberName() = "getAQlClass"
18+
) and
19+
not call.getLocation().getFile().getAbsolutePath().matches("%/" + ["meta", "test"] + "/%") and
20+
not call.getLocation().getFile().getBaseName().toLowerCase() =
21+
["consistency.ql", "test.ql", "tst.ql", "tests.ql"]
22+
select call, "Don't use .getAQlClass"

0 commit comments

Comments
 (0)