Add consistency query flagging unexpected frontend errors.

This commit is contained in:
Max Schaefer
2020-04-09 16:44:03 +01:00
parent bf42271d14
commit c6a37fdf1d
3 changed files with 23 additions and 0 deletions

View File

@@ -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

View File

@@ -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