From a30791833dcabdeb49e419fe9fd6bec5d099a509 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Wed, 17 Jan 2024 20:57:39 +0000 Subject: [PATCH 1/2] C#: Report any extracted file as successfully extracted --- .../change-notes/2024-01-17-csharp-successfully-extracted.md | 4 ++++ csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql | 5 +---- .../diagnostics/DiagnosticNoExtractorErrors.expected | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 csharp/ql/lib/change-notes/2024-01-17-csharp-successfully-extracted.md diff --git a/csharp/ql/lib/change-notes/2024-01-17-csharp-successfully-extracted.md b/csharp/ql/lib/change-notes/2024-01-17-csharp-successfully-extracted.md new file mode 100644 index 00000000000..1ed6b51d6c5 --- /dev/null +++ b/csharp/ql/lib/change-notes/2024-01-17-csharp-successfully-extracted.md @@ -0,0 +1,4 @@ +--- +category: minorAnalysis +--- +* The diagnostic query `cs/diagnostics/successfully-extracted-files`, and therefore the Code Scanning UI measure of scanned C# files, now considers any C# file seen during extraction, even one with some errors, to be extracted / scanned. diff --git a/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql b/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql index cd387c11b4d..9194ea25fba 100644 --- a/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql +++ b/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql @@ -11,8 +11,5 @@ import csharp import semmle.code.csharp.commons.Diagnostics from File file -where - file.fromSource() and - not exists(ExtractorError e | e.getLocation().getFile() = file) and - not exists(CompilerError e | e.getLocation().getFile() = file) +where file.fromSource() select file, "" diff --git a/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.expected b/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.expected index 17e4dc54b7d..d1248e5ee31 100644 --- a/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.expected +++ b/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.expected @@ -1 +1,2 @@ | A.cs:0:0:0:0 | A.cs | | +| Program.cs:0:0:0:0 | Program.cs | | From d0003ce7be27dc45ff090a8cd71a5ad02913bf76 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Thu, 18 Jan 2024 12:47:11 +0000 Subject: [PATCH 2/2] C#: Rename query to ExtractedFiles --- .../{DiagnosticNoExtractionErrors.ql => ExtractedFiles.ql} | 2 +- .../library-tests/diagnostics/DiagnosticNoExtractorErrors.qlref | 1 - ...nosticNoExtractorErrors.expected => ExtractedFiles.expected} | 0 csharp/ql/test/library-tests/diagnostics/ExtractedFiles.qlref | 1 + 4 files changed, 2 insertions(+), 2 deletions(-) rename csharp/ql/src/Diagnostics/{DiagnosticNoExtractionErrors.ql => ExtractedFiles.ql} (91%) delete mode 100644 csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.qlref rename csharp/ql/test/library-tests/diagnostics/{DiagnosticNoExtractorErrors.expected => ExtractedFiles.expected} (100%) create mode 100644 csharp/ql/test/library-tests/diagnostics/ExtractedFiles.qlref diff --git a/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql b/csharp/ql/src/Diagnostics/ExtractedFiles.ql similarity index 91% rename from csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql rename to csharp/ql/src/Diagnostics/ExtractedFiles.ql index 9194ea25fba..c1f35145abe 100644 --- a/csharp/ql/src/Diagnostics/DiagnosticNoExtractionErrors.ql +++ b/csharp/ql/src/Diagnostics/ExtractedFiles.ql @@ -1,5 +1,5 @@ /** - * @name Successfully extracted files + * @name Extracted files * @description A list of all files in the source code directory that were extracted * without encountering an extraction or compiler error in the file. * @kind diagnostic diff --git a/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.qlref b/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.qlref deleted file mode 100644 index 7994e050699..00000000000 --- a/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.qlref +++ /dev/null @@ -1 +0,0 @@ -Diagnostics/DiagnosticNoExtractionErrors.ql diff --git a/csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.expected b/csharp/ql/test/library-tests/diagnostics/ExtractedFiles.expected similarity index 100% rename from csharp/ql/test/library-tests/diagnostics/DiagnosticNoExtractorErrors.expected rename to csharp/ql/test/library-tests/diagnostics/ExtractedFiles.expected diff --git a/csharp/ql/test/library-tests/diagnostics/ExtractedFiles.qlref b/csharp/ql/test/library-tests/diagnostics/ExtractedFiles.qlref new file mode 100644 index 00000000000..e900e9c5314 --- /dev/null +++ b/csharp/ql/test/library-tests/diagnostics/ExtractedFiles.qlref @@ -0,0 +1 @@ +Diagnostics/ExtractedFiles.ql