summaryrefslogtreecommitdiff
path: root/ale_linters/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/cpp')
-rw-r--r--ale_linters/cpp/cppcheck.vim13
1 files changed, 5 insertions, 8 deletions
diff --git a/ale_linters/cpp/cppcheck.vim b/ale_linters/cpp/cppcheck.vim
index dae0774e..7cd80dbc 100644
--- a/ale_linters/cpp/cppcheck.vim
+++ b/ale_linters/cpp/cppcheck.vim
@@ -5,20 +5,17 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck')
call ale#Set('cpp_cppcheck_options', '--enable=style')
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
- " Search upwards from the file for compile_commands.json.
- "
- " If we find it, we'll `cd` to where the compile_commands.json file is,
- " then use the file to set up import paths, etc.
- let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer)
- let l:cd_command = !empty(l:dir) ? ale#path#CdString(l:dir) : ''
- let l:compile_commands_option = !empty(l:json_path)
- \ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ])
+ let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
+ 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)
\ : ''
return l:cd_command
\ . '%e -q --language=c++'
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
+ \ . l:buffer_path_include
\ . ' %t'
endfunction