Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4251 --file-filter option removed for cppcheck handler #4639

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions autoload/ale/handlers/cppcheck.vim
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ function! ale#handlers#cppcheck#GetCompileCommandsOptions(buffer) abort
let [l:dir, l:json_path] = ale#c#FindCompileCommands(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[len(l:dir) + 1: ]) . ' --file-filter=' . ale#Escape(bufname(a:buffer))
\ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ])
\ : ''
endfunction

Expand Down
2 changes: 0 additions & 2 deletions test/linter/test_c_cppcheck.vader
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Execute(cppcheck for C should detect compile_commands.json files):
\ . ' -q --language=c'
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape('compile_commands.json')
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'

Execute(cppcheck for C should detect compile_commands.json files in build directories):
Expand All @@ -36,7 +35,6 @@ Execute(cppcheck for C should detect compile_commands.json files in build direct
\ . ' -q --language=c'
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'

Execute(cppcheck for C should include file dir if compile_commands.json file is not found):
Expand Down
2 changes: 0 additions & 2 deletions test/linter/test_cpp_cppcheck.vader
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
\ . ' -q --language=c++'
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape('compile_commands.json')
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'

Execute(cppcheck for C++ should detect compile_commands.json files in build directories):
Expand All @@ -42,7 +41,6 @@ Execute(cppcheck for C++ should detect compile_commands.json files in build dire
\ . ' -q --language=c++'
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'

Execute(cppcheck for C++ should include file dir if compile_commands.json file is not found):
Expand Down