summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonatan Olofsson <jonatan.olofsson@gmail.com>2018-01-01 12:02:32 +0100
committerJonatan Olofsson <jonatan.olofsson@gmail.com>2018-01-02 16:09:38 +0100
commitff8d4c5286ff3d290b155a554289075afc653b8c (patch)
treef73ef62fe45e6443ccc640bacc39b32700550cb9
parent5285b0b332f067f56a6ac13a316db64acbac0c6b (diff)
downloadale-ff8d4c5286ff3d290b155a554289075afc653b8c.zip
Fix #1255: Move extra clang-check args to before user options
-rw-r--r--ale_linters/cpp/clangcheck.vim2
-rw-r--r--test/command_callback/test_cpp_clangcheck_command_callbacks.vader9
2 files changed, 6 insertions, 5 deletions
diff --git a/ale_linters/cpp/clangcheck.vim b/ale_linters/cpp/clangcheck.vim
index 4b6169c8..a109d5d3 100644
--- a/ale_linters/cpp/clangcheck.vim
+++ b/ale_linters/cpp/clangcheck.vim
@@ -24,9 +24,9 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
" detected.
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
\ . ' -analyze %s'
+ \ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
- \ . (empty(l:build_dir) ? ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text' : '')
endfunction
call ale#linter#Define('cpp', {
diff --git a/test/command_callback/test_cpp_clangcheck_command_callbacks.vader b/test/command_callback/test_cpp_clangcheck_command_callbacks.vader
index 34b87fc6..9e9f7f64 100644
--- a/test/command_callback/test_cpp_clangcheck_command_callbacks.vader
+++ b/test/command_callback/test_cpp_clangcheck_command_callbacks.vader
@@ -28,7 +28,7 @@ Execute(The executable should be used in the command):
AssertEqual
\ ale#Escape('clang-check')
\ . ' -analyze %s'
- \ . ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text',
+ \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text',
\ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
let b:ale_cpp_clangcheck_executable = 'foobar'
@@ -38,7 +38,7 @@ Execute(The executable should be used in the command):
AssertEqual
\ ale#Escape('foobar')
\ . ' -analyze %s'
- \ . ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text',
+ \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text',
\ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
Execute(The options should be configurable):
@@ -46,8 +46,9 @@ Execute(The options should be configurable):
AssertEqual
\ ale#Escape('clang-check')
- \ . ' -analyze %s --something'
- \ . ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text',
+ \ . ' -analyze %s'
+ \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text',
+ \ . ' --something'
\ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
Execute(The build directory should be used when set):