Java: split extractor diagnostics query into two

This commit is contained in:
yo-h
2021-05-03 11:34:18 -04:00
parent a7030c7fed
commit edf1a90161
3 changed files with 30 additions and 3 deletions

View File

@@ -51,12 +51,26 @@ private predicate unknownErrors(@diagnostic d, string msg, int sev) {
/**
* Holds if an extraction error or warning occurred that should be reported to end users,
* with the error message `msg` and SARIF severity `sev`.
* with the message `msg` and SARIF severity `sev`.
*/
predicate reportableDiagnostics(@diagnostic d, string msg, int sev) {
knownWarnings(d, msg, sev) or knownErrors(d, msg, sev) or unknownErrors(d, msg, sev)
reportableWarnings(d, msg, sev) or reportableErrors(d, msg, sev)
}
/**
* Holds if an extraction error occurred that should be reported to end users,
* with the message `msg` and SARIF severity `sev`.
*/
predicate reportableErrors(@diagnostic d, string msg, int sev) {
knownErrors(d, msg, sev) or unknownErrors(d, msg, sev)
}
/**
* Holds if an extraction warning occurred that should be reported to end users,
* with the message `msg` and SARIF severity `sev`.
*/
predicate reportableWarnings(@diagnostic d, string msg, int sev) { knownWarnings(d, msg, sev) }
/**
* Holds if compilation unit `f` is a source file that has
* no relevant extraction diagnostics associated with it.

View File

@@ -9,5 +9,5 @@ import java
import DiagnosticsReporting
from string msg, int sev
where reportableDiagnostics(_, msg, sev)
where reportableErrors(_, msg, sev)
select msg, sev

View File

@@ -0,0 +1,13 @@
/**
* @name Extraction warnings
* @description A list of extraction warnings for files in the source code directory.
* @kind diagnostic
* @id java/diagnostics/extraction-warnings
*/
import java
import DiagnosticsReporting
from string msg, int sev
where reportableWarnings(_, msg, sev)
select msg, sev