Merge pull request #19104 from michaelnebel/ql4ql/excludeprintastinlineexpect

QL4QL: Exclude PrintAst like tests from being reported as having missing InlineExpectations.
This commit is contained in:
Erik Krogh Kristensen
2025-03-25 09:42:22 +01:00
committed by GitHub
8 changed files with 20 additions and 1 deletions

View File

@@ -64,4 +64,15 @@ class QlRefDocument extends YamlDocument {
value = n.lookup("postprocess").(YamlSequence).getElement(_)
)
}
predicate isPrintAst() {
this.getFile().getStem() = "PrintAst"
or
exists(YamlMapping n, YamlScalar value |
n.getDocument() = this and
value.getValue().matches("%PrintAst%")
|
value = n.lookup("query")
)
}
}

View File

@@ -11,5 +11,7 @@ import ql
import codeql_ql.ast.Yaml
from QlRefDocument f
where not f.usesInlineExpectations()
where
not f.usesInlineExpectations() and
not f.isPrintAst()
select f, "Query test does not use inline test expectations."

View File

@@ -0,0 +1 @@
| |

View File

@@ -0,0 +1 @@
dummy/PrintAst.ql

View File

@@ -0,0 +1 @@
| |

View File

@@ -0,0 +1 @@
query: dummy/PrintAst.ql

View File

@@ -0,0 +1 @@
select ""