diff options
author | fenuks <fenuks@protonmail.com> | 2018-08-24 10:52:33 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-24 10:52:33 +0100 |
commit | 9d7c48038cbbc696fe2d1e9c4b2d9eff2dd726c3 (patch) | |
tree | d034973b8a46a11c883bfbd775298e5162e80c46 /ale_linters/cpp/clazy.vim | |
parent | 08d141edfb9cacea2ddba347581e670f4a04caa7 (diff) | |
download | ale-9d7c48038cbbc696fe2d1e9c4b2d9eff2dd726c3.zip |
Add clazy as cpp linter
Diffstat (limited to 'ale_linters/cpp/clazy.vim')
-rw-r--r-- | ale_linters/cpp/clazy.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ale_linters/cpp/clazy.vim b/ale_linters/cpp/clazy.vim new file mode 100644 index 00000000..cbbd0ccf --- /dev/null +++ b/ale_linters/cpp/clazy.vim @@ -0,0 +1,32 @@ +" Description: clazy linter for cpp files (clang-based and Qt-oriented) + +call ale#Set('cpp_clazy_executable', 'clazy-standalone') +" Set this option to check the checks clazy will apply. +call ale#Set('cpp_clazy_checks', ['level1']) +" Set this option to manually set some options for clazy. +" This will disable compile_commands.json detection. +call ale#Set('cpp_clazy_options', '') +call ale#Set('c_build_dir', '') + +function! ale_linters#cpp#clazy#GetCommand(buffer) abort + let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',') + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + + " Get the extra options if we couldn't find a build directory. + let l:options = ale#Var(a:buffer, 'cpp_clazy_options') + + return '%e' + \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') + \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %s' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'clazy', +\ 'output_stream': 'stderr', +\ 'executable_callback': ale#VarFunc('cpp_clazy_executable'), +\ 'command_callback': 'ale_linters#cpp#clazy#GetCommand', +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'lint_file': 1, +\}) |