summaryrefslogtreecommitdiff
path: root/ale_linters/cpp
diff options
context:
space:
mode:
authorJonathan Vander Mey <jvandermey@evertz.com>2019-06-08 15:12:43 -0400
committerJonathan Vander Mey <jvandermey@evertz.com>2019-06-08 15:35:08 -0400
commit3c799abb44a4cc9a7b6c5bfcf583862946e57240 (patch)
treef3cb9d909f72712ab83eaa08fd48a557fa9cb541 /ale_linters/cpp
parent7b78f2b846e2f3443dcb2ceacee54eb99e37f040 (diff)
downloadale-3c799abb44a4cc9a7b6c5bfcf583862946e57240.zip
Add additional option setting for clangtidy linter
The existing option setting handles setting additional compile flags to pass to clang-tidy. The new option setting added here allows setting additional clang-tidy specific flags to be passed as well. Fixes #2324
Diffstat (limited to 'ale_linters/cpp')
-rw-r--r--ale_linters/cpp/clangtidy.vim9
1 files changed, 8 insertions, 1 deletions
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index 841b795f..085bc332 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -5,9 +5,12 @@
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
" Set this option to check the checks clang-tidy will apply.
call ale#Set('cpp_clangtidy_checks', [])
-" Set this option to manually set some options for clang-tidy.
+" Set this option to manually set some options for clang-tidy to use as compile
+" flags.
" This will disable compile_commands.json detection.
call ale#Set('cpp_clangtidy_options', '')
+" Set this option to manually set options for clang-tidy directly.
+call ale#Set('cpp_clangtidy_extra_options', '')
call ale#Set('c_build_dir', '')
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
@@ -19,8 +22,12 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
\ ? ale#Var(a:buffer, 'cpp_clangtidy_options')
\ : ''
+ " Get the options to pass directly to clang-tidy
+ let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')
+
return '%e'
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
+ \ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
\ . ' %s'
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
\ . (!empty(l:options) ? ' -- ' . l:options : '')