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 " : luibo <ng.akhoa98@gmail.com>
3 " : Jorengarenar <jorengarenar@outlook.com>
4 " Description: clang-check linter for C files
5 " modified from cpp/clangcheck.vim to match for C
7 call ale#Set('c_clangcheck_executable', 'clang-check')
8 call ale#Set('c_clangcheck_options', '')
9 call ale#Set('c_build_dir', '')
11 function! ale_linters#c#clangcheck#GetCommand(buffer) abort
12 let l:user_options = ale#Var(a:buffer, 'c_clangcheck_options')
14 " Try to find compilation database to link automatically
15 let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
18 let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
19 let l:build_dir = ale#path#Dirname(l:json_file)
22 " The extra arguments in the command are used to prevent .plist files from
23 " being generated. These are only added if no build directory can be
25 return '%e -analyze %s'
26 \ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
27 \ . ale#Pad(l:user_options)
28 \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
31 call ale#linter#Define('c', {
32 \ 'name': 'clangcheck',
33 \ 'output_stream': 'stderr',
34 \ 'executable': {b -> ale#Var(b, 'c_clangcheck_executable')},
35 \ 'command': function('ale_linters#c#clangcheck#GetCommand'),
36 \ 'callback': 'ale#handlers#gcc#HandleGCCFormat',