File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ const criticalWarningTypes = [
2424 'preprocessorErrorDirective' ,
2525 'syntaxError' ,
2626 'unhandledChar' ,
27- 'unknownMacro'
27+ 'unknownMacro' ,
28+ 'checkersReport'
2829] ;
2930
3031function parseSeverity ( str : string ) : vscode . DiagnosticSeverity {
@@ -270,11 +271,11 @@ async function runCppcheckOnFileXML(
270271 for ( const e of errors ) {
271272 const isCriticalError = criticalWarningTypes . includes ( e . $ . id ) ;
272273 const locations = e . location || [ ] ;
273- if ( ! locations . length ) {
274+ if ( ! isCriticalError && ! locations . length ) {
274275 continue ;
275276 }
276277
277- const mainLoc = locations [ locations . length - 1 ] . $ ;
278+ const mainLoc = locations . length ? locations [ locations . length - 1 ] ?. $ : [ ] ;
278279
279280 // If main location is not current file, then skip displaying warning unless it is critical
280281 if ( ! isCriticalError && ! filePath . endsWith ( mainLoc . file ) ) {
You can’t perform that action at this time.
0 commit comments