mirror of
https://github.com/github/codeql.git
synced 2026-02-08 03:01:10 +01:00
add an consistency test for the totality of getParent()
This commit is contained in:
10
ql/consistency-queries/AstConsistency.ql
Normal file
10
ql/consistency-queries/AstConsistency.ql
Normal file
@@ -0,0 +1,10 @@
|
||||
import ql
|
||||
private import codeql_ql.ast.internal.AstNodes as AstNodes
|
||||
|
||||
query AstNode nonTotalGetParent() {
|
||||
exists(AstNodes::toQL(result).getParent()) and
|
||||
not exists(result.getParent()) and
|
||||
not result.getLocation().getStartColumn() = 1 and // startcolumn = 1 <=> top level in file <=> fine to have no parent
|
||||
not result instanceof YAML::YAMLNode and // parents for YAML doens't work
|
||||
not (result instanceof QLDoc and result.getLocation().getFile().getExtension() = "dbscheme") // qldoc in dbschemes are not hooked up
|
||||
}
|
||||
Reference in New Issue
Block a user