From 9e68b4f061bed4dd14f97f973d379f12697e82df Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Tue, 2 Mar 2021 13:13:16 -0800 Subject: [PATCH] Use codeQL.runningQueries.numberOfThreads to run interpretation When running `codeql bqrs interpret`, ensure the `codeQL.runningQueries.numberOfThreads` setting is respected. --- extensions/ql-vscode/CHANGELOG.md | 1 + extensions/ql-vscode/src/cli.ts | 6 ++++++ extensions/ql-vscode/src/config.ts | 8 +++++++- .../src/vscode-tests/minimal-workspace/config.test.ts | 4 ++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/extensions/ql-vscode/CHANGELOG.md b/extensions/ql-vscode/CHANGELOG.md index e7e9168f5..9bd907f84 100644 --- a/extensions/ql-vscode/CHANGELOG.md +++ b/extensions/ql-vscode/CHANGELOG.md @@ -2,6 +2,7 @@ ## [UNRELEASED] +- Respect the `codeQL.runningQueries.numberOfThreads` setting when creating SARIF files during result interpretation. [#771](https://github.com/github/vscode-codeql/pull/771) - Allow using raw LGTM project slugs for fetching LGTM databases. [#769](https://github.com/github/vscode-codeql/pull/769) ## 1.4.3 - 22 February 2021 diff --git a/extensions/ql-vscode/src/cli.ts b/extensions/ql-vscode/src/cli.ts index 1e264e325..e435c954d 100644 --- a/extensions/ql-vscode/src/cli.ts +++ b/extensions/ql-vscode/src/cli.ts @@ -597,6 +597,12 @@ export class CodeQLCliServer implements Disposable { '--source-location-prefix', sourceInfo.sourceLocationPrefix ); } + + args.push( + '--threads', + this.cliConfig.numberThreads.toString(), + ); + args.push(resultsPath); await this.runCodeQlCliCommand(['bqrs', 'interpret'], args, 'Interpreting query results'); diff --git a/extensions/ql-vscode/src/config.ts b/extensions/ql-vscode/src/config.ts index e1a3abb36..cad69c8e7 100644 --- a/extensions/ql-vscode/src/config.ts +++ b/extensions/ql-vscode/src/config.ts @@ -104,10 +104,11 @@ export interface QueryHistoryConfig { onDidChangeConfiguration: Event; } -const CLI_SETTINGS = [NUMBER_OF_TEST_THREADS_SETTING]; +const CLI_SETTINGS = [NUMBER_OF_TEST_THREADS_SETTING, NUMBER_OF_THREADS_SETTING]; export interface CliConfig { numberTestThreads: number; + numberThreads: number; onDidChangeConfiguration?: Event; } @@ -235,6 +236,11 @@ export class CliConfigListener extends ConfigListener implements CliConfig { return NUMBER_OF_TEST_THREADS_SETTING.getValue(); } + + public get numberThreads(): number { + return NUMBER_OF_THREADS_SETTING.getValue(); + } + protected handleDidChangeConfiguration(e: ConfigurationChangeEvent): void { this.handleDidChangeConfigurationForRelevantSettings(CLI_SETTINGS, e); } diff --git a/extensions/ql-vscode/src/vscode-tests/minimal-workspace/config.test.ts b/extensions/ql-vscode/src/vscode-tests/minimal-workspace/config.test.ts index e7bc6a5db..ee1c0cdc6 100644 --- a/extensions/ql-vscode/src/vscode-tests/minimal-workspace/config.test.ts +++ b/extensions/ql-vscode/src/vscode-tests/minimal-workspace/config.test.ts @@ -41,6 +41,10 @@ describe('config listeners', function() { { clazz: CliConfigListener, settings: [{ + name: 'codeQL.runningQueries.numberOfThreads', + property: 'numberThreads', + values: [0, 1] + }, { name: 'codeQL.runningTests.numberOfThreads', property: 'numberTestThreads', values: [1, 0]