8000 Java: report any extracted file as successfully extracted by smowton · Pull Request #14988 · github/codeql · GitHub
[go: up one dir, main page]

Skip to content

Java: report any extracted file as successfully extracted #14988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 7 additions & 3 deletions java/ql/src/Diagnostics/DiagnosticsReporting.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 3 additions & 3 deletions java/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,5 +11,5 @@ import java
import DiagnosticsReporting

from CompilationUnit f
where successfullyExtracted(f)
where extracted(f)
select f, ""
0