diff --git a/java/ql/lib/change-notes/2023-12-04-java-successfully-extracted.md b/java/ql/lib/change-notes/2023-12-04-java-successfully-extracted.md new file mode 100644 index 000000000000..6833e9c922de --- /dev/null +++ b/java/ql/lib/change-notes/2023-12-04-java-successfully-extracted.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* The diagnostic query `java/diagnostics/successfully-extracted-files`, and therefore the Code Scanning UI measure of scanned Java files, now considers any Java file seen during extraction, even one with some errors, to be extracted / scanned. diff --git a/java/ql/src/Diagnostics/DiagnosticsReporting.qll b/java/ql/src/Diagnostics/DiagnosticsReporting.qll index 63819fe02c26..77baf783f852 100644 --- a/java/ql/src/Diagnostics/DiagnosticsReporting.qll +++ b/java/ql/src/Diagnostics/DiagnosticsReporting.qll @@ -79,12 +79,16 @@ predicate reportableErrors(Diagnostic d, string msg, int sev) { */ predicate reportableWarnings(Diagnostic d, string msg, int sev) { knownWarnings(d, msg, sev) } +/** + * Holds if compilation unit `f` is a source file. + */ +predicate extracted(CompilationUnit f) { exists(f.getRelativePath()) and f.fromSource() } + /** * Holds if compilation unit `f` is a source file that has * no relevant extraction diagnostics associated with it. */ predicate successfullyExtracted(CompilationUnit f) { - not exists(Diagnostic d | reportableDiagnostics(d, _, _) and d.getLocation().getFile() = f) and - exists(f.getRelativePath()) and - f.fromSource() + extracted(f) and + not exists(Diagnostic d | reportableDiagnostics(d, _, _) and d.getLocation().getFile() = f) } diff --git a/java/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql b/java/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql index 0a1f2fd6caff..5551ca3140bc 100644 --- a/java/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql +++ b/java/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql @@ -1,7 +1,7 @@ /** - * @name Successfully extracted files + * @name Extracted files * @description A list of all files in the source code directory that - * were extracted without encountering an error in the file. + * were extracted. * @kind diagnostic * @id java/diagnostics/successfully-extracted-files * @tags successfully-extracted-files @@ -11,5 +11,5 @@ import java import DiagnosticsReporting from CompilationUnit f -where successfullyExtracted(f) +where extracted(f) select f, ""