Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -495,14 +496,15 @@ 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}'. ` +
`Please install cppcheck or set 'cppcheck-official.path' correctly.`
);
return;
}
usesPremiumCppcheck = stdout.toLowerCase().includes('premium');
});

await runCppcheckOnFileXML(
Expand Down Expand Up @@ -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}`);
Expand Down
Loading