summaryrefslogtreecommitdiff
path: root/ale_linters/cpp/cppcheck.vim
blob: adb3f4506963a88a6d8a86bbd1d62ddf06cf534d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
" Author: Bart Libert <bart.libert@gmail.com>
" Description: cppcheck linter for cpp files

" Set this option to change the cppcheck options
let g:ale_cpp_cppcheck_options = get(g:, 'ale_cpp_cppcheck_options', '--enable=style')

function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
    return 'cppcheck -q --language=c++ '
    \   . ale#Var(a:buffer, 'cpp_cppcheck_options')
    \   . ' %t'
endfunction

call ale#linter#Define('cpp', {
\   'name': 'cppcheck',
\   'output_stream': 'both',
\   'executable': 'cppcheck',
\   'command_callback': 'ale_linters#cpp#cppcheck#GetCommand',
\   'callback': 'ale#handlers#HandleCppCheckFormat',
\})