mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-30 14:45:29 +08:00
Fix --file-filter option on cppcheck command (#3987)
* Add cppcheck handler match on misra msg * Fix cppcheck --file-filter setting This time, the tests and actually usage both work. Co-authored-by: Dan George <dgeorge@anduril.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user