From 752b1c0936e2d615e20eddacbdb91baabcb120b3 Mon Sep 17 00:00:00 2001 From: Discookie Date: Fri, 30 Aug 2024 11:47:06 +0000 Subject: [PATCH] Add analysis timeout parameter --- README.md | 1 + package.json | 10 ++++++++-- src/backend/executor/bridge.ts | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c6a2ea0..bd77356 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ Since CodeChecker-related paths vary greatly between systems, the following sett | CodeChecker > Editor > Enable CodeLens
(default: `on`) | Enable CodeLens for displaying the reproduction path in the editor. | | CodeChecker > Executor > Enable notifications
(default: `on`) | Enable CodeChecker-related toast notifications. | | CodeChecker > Executor > Executable path
(default: `CodeChecker`) | Path to the CodeChecker executable. Can be an executable in the `PATH` environment variable, or an absolute path to one. | +| CodeChecker > Executor > Analysis timeout
(default: *60*) | The timeout (in seconds) for each individual analysis run by the CodeChecker analyze command - set to 0 to disable the timeout. | | CodeChecker > Executor > Thread count
(default: *(empty)*) | CodeChecker's thread count - leave empty to use all threads. | | CodeChecker > Executor > Arguments
(default: *(empty)*) | Additional arguments to `CodeChecker analyze`. For example, if you want to use a config file for CodeChecker pass '--config '. For supported arguments, run `CodeChecker analyze --help`.
*Note:* The resulting command-line can be previewed with the command `CodeChecker: Show full CodeChecker analyze command line`. | | CodeChecker > Executor > Log build command
(default: `make`) | The default build command used when running `CodeChecker log` via commands or tasks. | diff --git a/package.json b/package.json index bf9c95d..f66104b 100644 --- a/package.json +++ b/package.json @@ -149,6 +149,12 @@ "minimum": 1, "order": 5 }, + "codechecker.executor.analysisTimeout": { + "type": "number", + "description": "The timeout (in seconds) for each individual analysis run by the CodeChecker analyze command - set to 0 to disable the timeout", + "default": 60, + "order": 6 + }, "codechecker.executor.logBuildCommand": { "type": "string", "description": "The build command passed to CodeChecker log.", @@ -158,7 +164,7 @@ "type": "string", "description": "The build command passed to CodeChecker log.", "default": "make", - "order": 6 + "order": 7 }, "codechecker.executor.logArguments": { "type": "string", @@ -169,7 +175,7 @@ "type": "string", "description": "Additional arguments to CodeChecker log command. For supported arguments, run `CodeChecker log --help`. The command `CodeChecker: Preview CodeChecker log in terminal` command shows the resulting command line.", "default": "", - "order": 7 + "order": 8 }, "codechecker.editor.showDatabaseDialog": { "type": "boolean", diff --git a/src/backend/executor/bridge.ts b/src/backend/executor/bridge.ts index 7d3b941..0fad124 100644 --- a/src/backend/executor/bridge.ts +++ b/src/backend/executor/bridge.ts @@ -197,6 +197,8 @@ export class ExecutorBridge implements Disposable { : executorConfig.has('threadCount') ? executorConfig.get('threadCount') : undefined; // FIXME: Add support for selecting a specific workspace folder + const ccTimeout = workspace.getConfiguration('codechecker.executor').get('analysisTimeout') ?? 0; + const args = [ 'analyze', '--output', reportsFolder @@ -206,6 +208,10 @@ export class ExecutorBridge implements Disposable { args.push('-j', ccThreads); } + if (ccTimeout > 0) { + args.push('--timeout', ccTimeout.toString()); + } + if (this.checkedVersion < [6, 22, 0]) { const ccCompileCmd = this.getCompileCommandsPath( files.length