diff options
author | Jonathan Vander Mey <jvandermey@evertz.com> | 2019-06-08 15:12:43 -0400 |
---|---|---|
committer | Jonathan Vander Mey <jvandermey@evertz.com> | 2019-06-08 15:35:08 -0400 |
commit | 3c799abb44a4cc9a7b6c5bfcf583862946e57240 (patch) | |
tree | f3cb9d909f72712ab83eaa08fd48a557fa9cb541 /ale_linters/c/clangtidy.vim | |
parent | 7b78f2b846e2f3443dcb2ceacee54eb99e37f040 (diff) | |
download | ale-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/c/clangtidy.vim')
-rw-r--r-- | ale_linters/c/clangtidy.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ale_linters/c/clangtidy.vim b/ale_linters/c/clangtidy.vim index 6484f8af..f998866a 100644 --- a/ale_linters/c/clangtidy.vim +++ b/ale_linters/c/clangtidy.vim @@ -11,9 +11,12 @@ call ale#Set('c_clangtidy_executable', 'clang-tidy') " http://clang.llvm.org/extra/clang-tidy/checks/list.html call ale#Set('c_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('c_clangtidy_options', '') +" Set this option to manually set options for clang-tidy directly. +call ale#Set('c_clangtidy_extra_options', '') call ale#Set('c_build_dir', '') function! ale_linters#c#clangtidy#GetCommand(buffer) abort @@ -25,8 +28,12 @@ function! ale_linters#c#clangtidy#GetCommand(buffer) abort \ ? ale#Var(a:buffer, 'c_clangtidy_options') \ : '' + " Get the options to pass directly to clang-tidy + let l:extra_options = ale#Var(a:buffer, 'c_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 : '') |