summaryrefslogtreecommitdiff
path: root/ale_linters/cpp/clangtidy.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/cpp/clangtidy.vim')
-rw-r--r--ale_linters/cpp/clangtidy.vim13
1 files changed, 8 insertions, 5 deletions
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index ef7c63e8..11088c43 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -1,15 +1,18 @@
-" Author: vdeurzen <tim@kompiler.org>
+" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>
" Description: clang-tidy linter for cpp files
" Set this option to change the clang-tidy options for warnings for C.
-if !exists('g:ale_cpp_clangtidy_options')
- let g:ale_cpp_clangtidy_options = '-std=c++14 -Wall'
-endif
+let g:ale_cpp_clangtidy_options =
+\ get(g:, 'ale_cpp_clangtidy_options', '-std=c++14 -Wall')
+
+function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
+ return 'clang-tidy %t -- ' . g:ale_cpp_clangtidy_options
+endfunction
call ale#linter#Define('cpp', {
\ 'name': 'clangtidy',
\ 'output_stream': 'stdout',
\ 'executable': 'clang-tidy',
-\ 'command': g:ale#util#stdin_wrapper . ' -- ' . g:ale_cpp_clangtidy_options,
+\ 'command_callback': 'ale_linters#cpp#clangtidy#GetCommand',
\ 'callback': 'ale#handlers#HandleGCCFormat',
\})