diff --git a/extensions/ql-vscode/CHANGELOG.md b/extensions/ql-vscode/CHANGELOG.md index 8bd372c3196..cbd5b9ed593 100644 --- a/extensions/ql-vscode/CHANGELOG.md +++ b/extensions/ql-vscode/CHANGELOG.md @@ -1,5 +1,9 @@ # CodeQL for Visual Studio Code: Changelog +## [UNRELEASED] + +- Sorted result set filenames now include a hash of the result set name instead of the full name. [#2955](https://github.com/github/vscode-codeql/pull/2955) + ## 1.9.2 - 12 October 2023 - Fix a bug where the query to Find Definitions in database source files would not be cancelled appropriately. [#2885](https://github.com/github/vscode-codeql/pull/2885) diff --git a/extensions/ql-vscode/package-lock.json b/extensions/ql-vscode/package-lock.json index 44655777051..5158917b1c8 100644 --- a/extensions/ql-vscode/package-lock.json +++ b/extensions/ql-vscode/package-lock.json @@ -12,6 +12,7 @@ "dependencies": { "@octokit/plugin-retry": "^6.0.1", "@octokit/rest": "^20.0.2", + "@types/imurmurhash": "^0.1.2", "@vscode/codicons": "^0.0.31", "@vscode/debugadapter": "^1.59.0", "@vscode/debugprotocol": "^1.59.0", @@ -8966,6 +8967,11 @@ "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==", "dev": true }, + "node_modules/@types/imurmurhash": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/imurmurhash/-/imurmurhash-0.1.2.tgz", + "integrity": "sha512-T+LRivi3BTgPs5bMKGWJNXzuV0sI/8oNVgOdI8Iu0POTdqW5obXcRZ6+zcwU4u/3bYA659jZahrfe38h5eF2rw==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", @@ -38007,6 +38013,11 @@ "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==", "dev": true }, + "@types/imurmurhash": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/imurmurhash/-/imurmurhash-0.1.2.tgz", + "integrity": "sha512-T+LRivi3BTgPs5bMKGWJNXzuV0sI/8oNVgOdI8Iu0POTdqW5obXcRZ6+zcwU4u/3bYA659jZahrfe38h5eF2rw==" + }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", diff --git a/extensions/ql-vscode/package.json b/extensions/ql-vscode/package.json index 88e1e104117..7aa4e321a6e 100644 --- a/extensions/ql-vscode/package.json +++ b/extensions/ql-vscode/package.json @@ -2081,6 +2081,7 @@ "dependencies": { "@octokit/plugin-retry": "^6.0.1", "@octokit/rest": "^20.0.2", + "@types/imurmurhash": "^0.1.2", "@vscode/codicons": "^0.0.31", "@vscode/debugadapter": "^1.59.0", "@vscode/debugprotocol": "^1.59.0", diff --git a/extensions/ql-vscode/src/run-queries-shared.ts b/extensions/ql-vscode/src/run-queries-shared.ts index e595923c4ce..093b3eb5318 100644 --- a/extensions/ql-vscode/src/run-queries-shared.ts +++ b/extensions/ql-vscode/src/run-queries-shared.ts @@ -24,6 +24,7 @@ import { BaseLogger, showAndLogWarningMessage } from "./common/logging"; import { extLogger } from "./common/logging/vscode"; import { generateSummarySymbolsFile } from "./log-insights/summary-parser"; import { getErrorMessage } from "./common/helpers-pure"; +import * as MurmurHash3 from "imurmurhash"; /** * run-queries.ts @@ -150,7 +151,9 @@ export class QueryEvaluationInfo extends QueryOutputDir { }; } getSortedResultSetPath(resultSetName: string) { - return join(this.querySaveDir, `sortedResults-${resultSetName}.bqrs`); + const hasher = new MurmurHash3.default(); + hasher.hash(resultSetName); + return join(this.querySaveDir, `sortedResults-${hasher.result()}.bqrs`); } /** diff --git a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts index 9030e063c9b..d204379e9de 100644 --- a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts +++ b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-results.test.ts @@ -160,7 +160,7 @@ describe("query-results", () => { const expectedResultsPath = join(queryPath, "results.bqrs"); const expectedSortedResultsPath = join( queryPath, - "sortedResults-a-result-set-name.bqrs", + "sortedResults-1110391921.bqrs", ); expect(spy).toBeCalledWith( expectedResultsPath,