Skip to content

Commit edf1a90

Browse files
committed
Java: split extractor diagnostics query into two
1 parent a7030c7 commit edf1a90

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

java/ql/src/Diagnostics/DiagnosticsReporting.qll

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,26 @@ private predicate unknownErrors(@diagnostic d, string msg, int sev) {
5151

5252
/**
5353
* Holds if an extraction error or warning occurred that should be reported to end users,
54-
* with the error message `msg` and SARIF severity `sev`.
54+
* with the message `msg` and SARIF severity `sev`.
5555
*/
5656
predicate reportableDiagnostics(@diagnostic d, string msg, int sev) {
57-
knownWarnings(d, msg, sev) or knownErrors(d, msg, sev) or unknownErrors(d, msg, sev)
57+
reportableWarnings(d, msg, sev) or reportableErrors(d, msg, sev)
5858
}
5959

60+
/**
61+
* Holds if an extraction error occurred that should be reported to end users,
62+
* with the message `msg` and SARIF severity `sev`.
63+
*/
64+
predicate reportableErrors(@diagnostic d, string msg, int sev) {
65+
knownErrors(d, msg, sev) or unknownErrors(d, msg, sev)
66+
}
67+
68+
/**
69+
* Holds if an extraction warning occurred that should be reported to end users,
70+
* with the message `msg` and SARIF severity `sev`.
71+
*/
72+
predicate reportableWarnings(@diagnostic d, string msg, int sev) { knownWarnings(d, msg, sev) }
73+
6074
/**
6175
* Holds if compilation unit `f` is a source file that has
6276
* no relevant extraction diagnostics associated with it.

java/ql/src/Diagnostics/ExtractionErrors.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ import java
99
import DiagnosticsReporting
1010

1111
from string msg, int sev
12-
where reportableDiagnostics(_, msg, sev)
12+
where reportableErrors(_, msg, sev)
1313
select msg, sev
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @name Extraction warnings
3+
* @description A list of extraction warnings for files in the source code directory.
4+
* @kind diagnostic
5+
* @id java/diagnostics/extraction-warnings
6+
*/
7+
8+
import java
9+
import DiagnosticsReporting
10+
11+
from string msg, int sev
12+
where reportableWarnings(_, msg, sev)
13+
select msg, sev

0 commit comments

Comments
 (0)