Skip to content

Commit 9d3d3de

Browse files
authored
Merge pull request github#19104 from michaelnebel/ql4ql/excludeprintastinlineexpect
QL4QL: Exclude PrintAst like tests from being reported as having missing InlineExpectations.
2 parents f7026c2 + be4c9d8 commit 9d3d3de

File tree

8 files changed

+20
-1
lines changed

8 files changed

+20
-1
lines changed

ql/ql/src/codeql_ql/ast/Yaml.qll

+11
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,15 @@ class QlRefDocument extends YamlDocument {
6464
value = n.lookup("postprocess").(YamlSequence).getElement(_)
6565
)
6666
}
67+
68+
predicate isPrintAst() {
69+
this.getFile().getStem() = "PrintAst"
70+
or
71+
exists(YamlMapping n, YamlScalar value |
72+
n.getDocument() = this and
73+
value.getValue().matches("%PrintAst%")
74+
|
75+
value = n.lookup("query")
76+
)
77+
}
6778
}

ql/ql/src/queries/style/QlRefInlineExpectations.ql

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ import ql
1111
import codeql_ql.ast.Yaml
1212

1313
from QlRefDocument f
14-
where not f.usesInlineExpectations()
14+
where
15+
not f.usesInlineExpectations() and
16+
not f.isPrintAst()
1517
select f, "Query test does not use inline test expectations."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dummy/PrintAst.ql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
query: dummy/PrintAst.ql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
select ""

0 commit comments

Comments
 (0)