summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorDan George <dgeorge83616@yahoo.com>2021-11-20 02:01:32 -0800
committerGitHub <noreply@github.com>2021-11-20 19:01:32 +0900
commit072750137f752c0a09fd1ff493da2bea6519b7ef (patch)
treeafa57e9b85d20b48507b7e27fad29e440c7c937e /autoload
parentea643b97ab08e571a543f4bd89cd3170f3f288e2 (diff)
downloadale-072750137f752c0a09fd1ff493da2bea6519b7ef.zip
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>
Diffstat (limited to 'autoload')
-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