summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorBart Libert <lapino@gmail.com>2016-10-20 13:30:45 +0200
committerw0rp <w0rp@users.noreply.github.com>2016-10-20 12:30:45 +0100
commita34fb0a6a7f920cd4d9a3e50facf51f8d5defea2 (patch)
tree74b97ad98e528be7df75259275ada10451769b12 /autoload
parentacb209aa11960211718b7cb9b55688e5be1adc63 (diff)
downloadale-a34fb0a6a7f920cd4d9a3e50facf51f8d5defea2.zip
Add support for cppcheck (#126)
* Add support for cppcheck * Fix vint error in cppcheck handler * Add vader test for CppCheck format handler
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:
"