cppcheck: don't pass source file if --project is specified (#5075)

This is no longer supported as of version 2.13.0.

Fixes: #4854
This commit is contained in:
Eric T. Johnson
2025-12-20 19:59:13 -08:00
committed by GitHub
parent 710e1aac9c
commit fa3d4f2f13
4 changed files with 16 additions and 6 deletions

View File

@@ -10,13 +10,18 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
" Versions >=2.13 don't allow using --project in conjunction with an
" explicit source file.
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
\ ? ' %t'
\ : ''
return '%e -q --language=c++'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
\ . l:buffer_path_include
\ . ' %t'
\ . l:source_file
endfunction
call ale#linter#Define('cpp', {