Skip to content
Closed
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const criticalWarningTypes = [
'preprocessorErrorDirective',
'syntaxError',
'unhandledChar',
'unknownMacro'
'unknownMacro',
'checkersReport'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just weird to put checkersReport in "criticalWarningTypes" because it's not critical

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am skeptic that users wants to see the checkersReport typically. maybe it could be optional.

];

function parseSeverity(str: string): vscode.DiagnosticSeverity {
Expand Down Expand Up @@ -270,11 +271,11 @@ async function runCppcheckOnFileXML(
for (const e of errors) {
const isCriticalError = criticalWarningTypes.includes(e.$.id);
const locations = e.location || [];
if (!locations.length) {
if (!isCriticalError && !locations.length) {
continue;
}

const mainLoc = locations[locations.length - 1].$;
const mainLoc = locations.length ? locations[locations.length - 1]?.$ : [];

// If main location is not current file, then skip displaying warning unless it is critical
if (!isCriticalError && !filePath.endsWith(mainLoc.file)) {
Expand Down