1
0
Fork 0
mirror of synced 2024-12-23 07:20:42 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/c/cppcheck.vim

30 lines
1.2 KiB
VimL
Raw Normal View History

" Author: Bart Libert <bart.libert@gmail.com>
" Description: cppcheck linter for c files
call ale#Set('c_cppcheck_executable', 'cppcheck')
call ale#Set('c_cppcheck_options', '--enable=style')
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
2019-08-22 11:36:17 -04:00
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
let l:buffer_path_include = empty(l:compile_commands_option)
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
2021-05-05 04:25:00 -04:00
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
2021-05-05 04:25:00 -04:00
return '%e -q --language=c'
2020-12-04 16:15:32 -05:00
\ . l:template
2019-08-22 11:36:17 -04:00
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
\ . l:buffer_path_include
\ . ' %t'
endfunction
call ale#linter#Define('c', {
\ 'name': 'cppcheck',
\ 'output_stream': 'both',
2019-03-08 06:04:56 -05:00
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
2021-05-05 04:25:00 -04:00
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
2019-03-08 06:04:56 -05:00
\ 'command': function('ale_linters#c#cppcheck#GetCommand'),
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
\})