summaryrefslogtreecommitdiff
path: root/ale_linters/cpp
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2021-03-01 20:11:10 +0000
committerw0rp <devw0rp@gmail.com>2021-03-01 20:11:10 +0000
commit9fe7b1fe6a23fb55e6d782293585d58193123f59 (patch)
tree0403deb70011aee7be08e586b10b5828cf69499e /ale_linters/cpp
parent48fab99a0ab793e1b9607795c21659f12bd6947f (diff)
downloadale-9fe7b1fe6a23fb55e6d782293585d58193123f59.zip
Close #2281 - Separate cwd commands from commands
Working directories are now set seperately from the commands so they can later be swapped out when running linters over projects is supported, and also better support filename mapping for running linters on other machines in future.
Diffstat (limited to 'ale_linters/cpp')
-rw-r--r--ale_linters/cpp/cppcheck.vim5
1 files changed, 2 insertions, 3 deletions
diff --git a/ale_linters/cpp/cppcheck.vim b/ale_linters/cpp/cppcheck.vim
index 2578861d..eb86adf4 100644
--- a/ale_linters/cpp/cppcheck.vim
+++ b/ale_linters/cpp/cppcheck.vim
@@ -5,15 +5,13 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck')
call ale#Set('cpp_cppcheck_options', '--enable=style')
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
- 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)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
- return l:cd_command
- \ . '%e -q --language=c++'
+ return '%e -q --language=c++'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
@@ -25,6 +23,7 @@ call ale#linter#Define('cpp', {
\ 'name': 'cppcheck',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
+\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
\})