summaryrefslogtreecommitdiff
path: root/ale_linters/cpp/clangtidy.vim
diff options
context:
space:
mode:
authorfenuks <fenuks>2021-01-22 01:01:26 +0100
committerfenuks <fenuks>2021-01-22 15:19:38 +0100
commit65824feef320f56a9f645cfe1a3107ff8717372a (patch)
tree4a0987ebb538dd3034f8423909fb853848065dd3 /ale_linters/cpp/clangtidy.vim
parenta1e6df987c28dd3e0efb7422f4ad85ee3bb3bebc (diff)
downloadale-65824feef320f56a9f645cfe1a3107ff8717372a.zip
Fix clang-tidy ignoring compile_commands.json
Diffstat (limited to 'ale_linters/cpp/clangtidy.vim')
-rw-r--r--ale_linters/cpp/clangtidy.vim10
1 files changed, 6 insertions, 4 deletions
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index 5e062d86..d6944aae 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -23,11 +23,13 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
- endif
- " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file.
- if expand('#' . a:buffer) =~# '\.h$'
- let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
+ " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
+ " only when compile-commands.json file is not there. Adding these
+ " flags makes clang-tidy completely ignore compile commmands.
+ if expand('#' . a:buffer) =~# '\.h$'
+ let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
+ endif
endif
" Get the options to pass directly to clang-tidy