Files
codeql/python/ql/test/library-tests/jump_to_defn/Consistency.ql
Taus Brock-Nannestad f07a7bf8cf Python: Autoformat everything using qlformat.
Will need subsequent PRs fixing up test failures (due to deprecated
methods moving around), but other than that everything should be
straight-forward.
2020-07-07 15:43:52 +02:00

22 lines
813 B
Plaintext

import python
import analysis.DefinitionTracking
import analysis.CrossProjectDefinitions
predicate local_problem(Definition defn, string issue, string repr) {
not exists(defn.toString()) and issue = "no toString()" and repr = "a local definition"
or
not exists(defn.getAstNode()) and issue = "no getAstNode()" and repr = defn.toString()
or
not exists(defn.getLocation()) and issue = "no getLocation()" and repr = defn.toString()
or
count(defn.getLocation()) > 1 and issue = "more than one getLocation()" and repr = defn.toString()
}
predicate remote_problem(Symbol s, string issue, string repr) {
not exists(s.toString()) and issue = "no toString()" and repr = "a symbol"
}
from string issue, string repr
where remote_problem(_, issue, repr) or local_problem(_, issue, repr)
select issue, repr