We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getParent()
1 parent 9a02a22 commit 8391580Copy full SHA for 8391580
1 file changed
ql/consistency-queries/AstConsistency.ql
@@ -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