summaryrefslogtreecommitdiff
path: root/autoload/ale/handlers/cppcheck.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/handlers/cppcheck.vim')
-rw-r--r--autoload/ale/handlers/cppcheck.vim4
1 files changed, 1 insertions, 3 deletions
diff --git a/autoload/ale/handlers/cppcheck.vim b/autoload/ale/handlers/cppcheck.vim
index cf69df26..150bb007 100644
--- a/autoload/ale/handlers/cppcheck.vim
+++ b/autoload/ale/handlers/cppcheck.vim
@@ -46,13 +46,11 @@ function! ale#handlers#cppcheck#GetCompileCommandsOptions(buffer) abort
" 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 b:root_index = len(l:dir) + 1
- let b:buffer_file= bufname(a:buffer)
" By default, cppcheck processes every config in compile_commands.json.
" Use --file-filter to limit to just the buffer file.
return !empty(l:json_path)
- \ ? '--project=' . ale#Escape(l:json_path[b:root_index: ]) . ' --file-filter=' . ale#Escape(b:buffer_file[b:root_index:])
+ \ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ]) . ' --file-filter=' . ale#Escape(bufname(a:buffer))
\ : ''
endfunction