summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/handlers.vim30
1 files changed, 29 insertions, 1 deletions
diff --git a/autoload/ale/handlers.vim b/autoload/ale/handlers.vim
index cca35d46..5322bfb2 100644
--- a/autoload/ale/handlers.vim
+++ b/autoload/ale/handlers.vim
@@ -45,7 +45,6 @@ function! ale#handlers#HandleUnixFormatAsWarning(buffer, lines) abort
return s:HandleUnixFormat(a:buffer, a:lines, 'W')
endfunction
-
function! ale#handlers#HandleGCCFormat(buffer, lines) abort
" Look for lines like the following.
"
@@ -76,6 +75,35 @@ function! ale#handlers#HandleGCCFormat(buffer, lines) abort
return l:output
endfunction
+function! ale#handlers#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:output = []
+
+ for l:line in a:lines
+ let l:match = matchlist(l:line, l:pattern)
+
+ if len(l:match) == 0
+ continue
+ endif
+
+ call add(l:output, {
+ \ 'bufnr': a:buffer,
+ \ 'lnum': l:match[1] + 0,
+ \ 'vcol': 0,
+ \ 'col': 0,
+ \ 'text': l:match[3] . ' (' . l:match[2] . ')',
+ \ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
+ \ 'nr': -1,
+ \})
+ endfor
+ return l:output
+
+endfunction
+
+
function! ale#handlers#HandleCSSLintFormat(buffer, lines) abort
" Matches patterns line the following:
"