From 4bc85294903b4f39d8fc050ee179ef80ad95e415 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Wed, 26 Oct 2022 16:28:02 +0100 Subject: [PATCH 1/3] Go: Extract locations of successfully extracted files Switch the successfully extracted files query to the `location, message` results format so that we get rich location information when exporting the results of this query to SARIF. Previously the query used the `message` results format, which meant the interpreted results lacked a location. --- go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql b/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql index e0ba130ed19..943c603cb89 100644 --- a/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql +++ b/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql @@ -9,5 +9,6 @@ import go from File f -where not exists(Error e | e.getFile() = f) -select f.getRelativePath() +where not exists(Error e | e.getFile() = f) and + exists(f.getRelativePath()) +select f, "" From b0b321a16f1e0cac1076f2b05fd4ea1e906bea5c Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Wed, 26 Oct 2022 16:31:08 +0100 Subject: [PATCH 2/3] Go: Standardise formatting --- go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql b/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql index 943c603cb89..5a5f5d995a2 100644 --- a/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql +++ b/go/ql/src/Diagnostics/SuccessfullyExtractedFiles.ql @@ -9,6 +9,7 @@ import go from File f -where not exists(Error e | e.getFile() = f) and +where + not exists(Error e | e.getFile() = f) and exists(f.getRelativePath()) select f, "" From c1984ea35f371de2636da621e3fc29bf503841fe Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Wed, 26 Oct 2022 19:11:21 +0100 Subject: [PATCH 3/3] Go: Update expected output --- .../query-tests/Diagnostics/SuccessfullyExtractedFiles.expected | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected b/go/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected index 1791a62090c..2b5394e8434 100644 --- a/go/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected +++ b/go/ql/test/query-tests/Diagnostics/SuccessfullyExtractedFiles.expected @@ -1 +1 @@ -| query-tests/Diagnostics/util.go | +| util.go:0:0:0:0 | util.go | |