From cb24e18a1ffae7c91aa4127dc82201429d415d1b Mon Sep 17 00:00:00 2001 From: davidramnero Date: Wed, 9 Sep 2026 10:17:07 +0200 Subject: [PATCH] fix / #114 disable safety if using premium --- src/extension.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index b5ff3dd..e86f8e3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -27,6 +27,7 @@ let cppcheckProgressIndicator: vscode.StatusBarItem; let severityOption: vscode.StatusBarItem; let hiddenTypesOption: vscode.StatusBarItem; let checksRunning = false; +let usesPremiumCppcheck = false; enum SeverityNumber { Info = 0, @@ -495,7 +496,7 @@ export async function activate(context: vscode.ExtensionContext) { } // Check if cppcheck is available - cp.exec(`"${commandPath}" --version`, (error) => { + cp.exec(`"${commandPath}" --version`, (error, stdout) => { if (error) { vscode.window.showErrorMessage( `Cppcheck: Could not find or run '${commandPath}'. ` + @@ -503,6 +504,7 @@ export async function activate(context: vscode.ExtensionContext) { ); return; } + usesPremiumCppcheck = stdout.toLowerCase().includes('premium'); }); await runCppcheckOnFileXML( @@ -621,6 +623,10 @@ async function runCppcheckOnFileXML( ...argsParsed, ].filter(Boolean); + if (usesPremiumCppcheck) { + args.push('--premium=safety-off'); + } + if (processedArgs.includes("--project=")) { usingProjectFile = true; args.push(`--file-filter=${filePath}`);