diff --git a/ql/test/consistency/UnexpectedFrontendErrors.expected b/ql/test/consistency/UnexpectedFrontendErrors.expected new file mode 100644 index 00000000000..e69de29bb2d diff --git a/ql/test/consistency/UnexpectedFrontendErrors.ql b/ql/test/consistency/UnexpectedFrontendErrors.ql new file mode 100644 index 00000000000..f75e2c6bf21 --- /dev/null +++ b/ql/test/consistency/UnexpectedFrontendErrors.ql @@ -0,0 +1,16 @@ +/** + * @name Unexpected frontend error + * @description This query produces a list of all errors produced by the Go frontend + * during extraction, except for those occurring in files annotated with + * "// codeql test: expect frontend errors". + * @id go/unexpected-frontend-error + */ + +import go + +from Error e +where + not exists(Comment c | c.getFile() = e.getFile() | + c.getText().trim() = "codeql test: expect frontend errors" + ) +select e diff --git a/ql/test/consistency/test.go b/ql/test/consistency/test.go new file mode 100644 index 00000000000..ca40bd0f601 --- /dev/null +++ b/ql/test/consistency/test.go @@ -0,0 +1,7 @@ +package main + +// Example file with a syntax error to demonstrate use of "expect frontend errors" directive + +// codeql test: expect frontend errors + +This is not a valid Go program