Ql4Ql: Exclude files named PrintAst.qlref and qlref files that uses a query with a PrintAst name from QlRefInlineExpectations.

This commit is contained in:
Michael Nebel
2025-03-24 16:20:51 +01:00
parent 2a8a8224f1
commit 7dda951a51
2 changed files with 14 additions and 1 deletions

View File

@@ -64,4 +64,15 @@ class QlRefDocument extends YamlDocument {
value = n.lookup("postprocess").(YamlSequence).getElement(_) 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 import codeql_ql.ast.Yaml
from QlRefDocument f 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." select f, "Query test does not use inline test expectations."