Skip to content

Commit 8391580

Browse files
committed
QL: add an consistency test for the totality of getParent()
1 parent 9a02a22 commit 8391580

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import ql
2+
private import codeql_ql.ast.internal.AstNodes as AstNodes
3+
4+
query AstNode nonTotalGetParent() {
5+
exists(AstNodes::toQL(result).getParent()) and
6+
not exists(result.getParent()) and
7+
not result.getLocation().getStartColumn() = 1 and // startcolumn = 1 <=> top level in file <=> fine to have no parent
8+
not result instanceof YAML::YAMLNode and // parents for YAML doens't work
9+
not (result instanceof QLDoc and result.getLocation().getFile().getExtension() = "dbscheme") // qldoc in dbschemes are not hooked up
10+
}

0 commit comments

Comments
 (0)