move diagnostics queries to match other languages more closely

This commit is contained in:
Alex Ford
2021-05-11 19:34:10 +01:00
parent 1381d8d076
commit 9b115129fe
4 changed files with 23 additions and 17 deletions

View File

@@ -0,0 +1,18 @@
/**
* @name Extraction errors
* @description List all extraction errors for files in the source code directory.
* @kind diagnostic
* @id rb/diagnostics/extraction-errors
*/
import ruby
import codeql_ruby.Diagnostics
/** Gets the SARIF severity to associate an error. */
int getSeverity() { result = 2 }
from ExtractionError error, File f
where
f = error.getLocation().getFile() and
exists(f.getRelativePath())
select error, "Extraction failed in " + f + " with error " + error.getMessage(), getSeverity()

View File

@@ -1,14 +0,0 @@
/**
* @name Files extracted with errors
* @description Lists files that were extracted, but may be incomplete due to
* extraction errors.
* @kind diagnostic
* @id rb/diagnostics/files-extracted-with-errors
*/
import ruby
import codeql_ruby.Diagnostics
from File f
where exists(ExtractionError e | e.getLocation().getFile() = f)
select f, ""

View File

@@ -1,7 +1,7 @@
/**
* @name Successfully extracted files
* @description Lists all files that were extracted without encountering an
* error in the file.
* @description Lists all files in the source code directory that were extracted
* without encountering an error in the file.
* @kind diagnostic
* @id rb/diagnostics/successfully-extracted-files
*/
@@ -10,5 +10,7 @@ import ruby
import codeql_ruby.Diagnostics
from File f
where not exists(ExtractionError e | e.getLocation().getFile() = f)
where
not exists(ExtractionError e | e.getLocation().getFile() = f) and
exists(f.getRelativePath())
select f, ""