mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 13:02:28 +08:00
Fix #677 - Ignore errors from other files for cppcheck
This commit is contained in:
@@ -4,16 +4,17 @@ function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" [test.cpp:5]: (error) Array 'a[10]' accessed at index 10, which is out of bounds
|
||||
let l:pattern = '^\[.\{-}:\(\d\+\)\]: (\(.\{-}\)) \(.\+\)'
|
||||
let l:pattern = '\v^\[(.+):(\d+)\]: \(([a-z]+)\) (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:match[3] . ' (' . l:match[2] . ')',
|
||||
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] ==# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
Reference in New Issue
Block a user