parent
e98560a349
commit
dc647fcc7f
@ -62,7 +62,7 @@ name. That seems to be the fairest way to arrange this table.
|
||||
| Bash | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
|
||||
| Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/)|
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/)|
|
||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) |
|
||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
||||
|
37
ale_linters/cpp/clangcheck.vim
Normal file
37
ale_linters/cpp/clangcheck.vim
Normal file
@ -0,0 +1,37 @@
|
||||
" Author: gagbo <gagbobada@gmail.com>
|
||||
" Description: clang-check linter for cpp files
|
||||
|
||||
" Set this option to manually set some options for clang-check.
|
||||
let g:ale_cpp_clangcheck_options = get(g:, 'ale_cpp_clangcheck_options', '')
|
||||
|
||||
" Set this option to manually point to the build directory for clang-tidy.
|
||||
" This will disable all the other clangtidy_options, since compilation
|
||||
" flags are contained in the json
|
||||
let g:ale_c_build_dir = get(g:, 'ale_c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
|
||||
let l:extra_options = !empty(l:user_options)
|
||||
\ ? l:user_options
|
||||
\ : ''
|
||||
|
||||
" Try to find compilation database to link automatically
|
||||
let l:user_build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
if empty(l:user_build_dir)
|
||||
let l:user_build_dir = ale#c#FindCompileCommands(a:buffer)
|
||||
endif
|
||||
let l:build_options = !empty(l:user_build_dir)
|
||||
\ ? ' -p ' . ale#Escape(l:user_build_dir)
|
||||
\ : ''
|
||||
|
||||
return 'clang-check -analyze ' . '%s' . l:extra_options . l:build_options
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangcheck',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'clang-check',
|
||||
\ 'command_callback': 'ale_linters#cpp#clangcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
@ -44,6 +44,29 @@ g:ale_cpp_clang_options *g:ale_cpp_clang_options*
|
||||
This variable can be changed to modify flags given to clang.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
clangcheck *ale-cpp-clangcheck*
|
||||
|
||||
`clang-check` will be run only when files are saved to disk, so that
|
||||
`compile_commands.json` files can be used. It is recommended to use this
|
||||
linter in combination with `compile_commands.json` files.
|
||||
Therefore, `clang-check` linter reads the options |g:ale_c_build_dir| and
|
||||
|g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually
|
||||
overrides |g:ale_c_build_dir_names|.
|
||||
|
||||
|
||||
g:ale_cpp_clangcheck_options *g:ale_cpp_clangcheck_options*
|
||||
*b:ale_cpp_clangcheck_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be changed to modify flags given to clang-check.
|
||||
|
||||
This variable should not be set to point to build subdirectory with
|
||||
`-p path/to/build` option, as it is handled by the |g:ale_c_build_dir|
|
||||
option.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
clangtidy *ale-cpp-clangtidy*
|
||||
|
||||
@ -73,11 +96,15 @@ g:ale_cpp_clangtidy_options *g:ale_cpp_clangtidy_options*
|
||||
|
||||
This variable can be changed to modify flags given to clang-tidy.
|
||||
|
||||
Setting this variable to a non-empty string will cause the `--` argument
|
||||
to be passed to `clang-tidy`, which will mean that detection of
|
||||
`compile_commands.json` files for compile command databases will be
|
||||
disabled. Only set this option if you want to control compiler flags
|
||||
entirely manually.
|
||||
- Setting this variable to a non-empty string,
|
||||
- and working in a buffer where no compilation database is found using
|
||||
|g:ale_c_build_dir_names| or |g:ale_c_build_dir|,
|
||||
will cause the `--` argument to be passed to `clang-tidy`, which will mean
|
||||
that detection of `compile_commands.json` files for compile command
|
||||
databases will be disabled.
|
||||
Only set this option if you want to control compiler flags
|
||||
entirely manually, and no `compile_commands.json` file is in one
|
||||
of the |g:ale_c_build_dir_names| directories of the project tree.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
@ -21,6 +21,7 @@ CONTENTS *ale-contents*
|
||||
foodcritic..........................|ale-chef-foodcritic|
|
||||
cpp...................................|ale-cpp-options|
|
||||
clang...............................|ale-cpp-clang|
|
||||
clangcheck..........................|ale-cpp-clangcheck|
|
||||
clangtidy...........................|ale-cpp-clangtidy|
|
||||
cppcheck............................|ale-cpp-cppcheck|
|
||||
cpplint.............................|ale-cpp-cpplint|
|
||||
|
Loading…
Reference in New Issue
Block a user