All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: gagbo <gagbobada@gmail.com>
2 " Description: clang-check linter for cpp files
4 call ale#Set('cpp_clangcheck_executable', 'clang-check')
5 call ale#Set('cpp_clangcheck_options', '')
6 call ale#Set('c_build_dir', '')
8 function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
9 let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
11 " Try to find compilation database to link automatically
12 let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
15 let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
16 let l:build_dir = ale#path#Dirname(l:json_file)
19 " The extra arguments in the command are used to prevent .plist files from
20 " being generated. These are only added if no build directory can be
22 return '%e -analyze %s'
23 \ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
24 \ . ale#Pad(l:user_options)
25 \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
28 call ale#linter#Define('cpp', {
29 \ 'name': 'clangcheck',
30 \ 'output_stream': 'stderr',
31 \ 'executable': {b -> ale#Var(b, 'cpp_clangcheck_executable')},
32 \ 'command': function('ale_linters#cpp#clangcheck#GetCommand'),
33 \ 'callback': 'ale#handlers#gcc#HandleGCCFormat',