Merge pull request #329 from tomotanakamura/AddClangToCpp

Add clang to cpp linters.
This commit is contained in:
w0rp 2017-02-11 13:10:18 +00:00 committed by GitHub
commit 8ad85858b8
3 changed files with 54 additions and 23 deletions

View File

@ -53,7 +53,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/) | | 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/) | | 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 | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
| C++ (filetype cpp) | [cppcheck] (http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)| | C++ (filetype cpp) | [cppcheck] (http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) | | C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) |
| Chef | [foodcritic](http://www.foodcritic.io/) | | Chef | [foodcritic](http://www.foodcritic.io/) |
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) | | CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |

20
ale_linters/cpp/clang.vim Normal file
View File

@ -0,0 +1,20 @@
" Author: Tomota Nakamura <https://github.com/tomotanakamura>
" Description: clang linter for cpp files
" Set this option to change the Clang options for warnings for CPP.
if !exists('g:ale_cpp_clang_options')
" let g:ale_cpp_clang_options = '-Wall'
" let g:ale_cpp_clang_options = '-std=c99 -Wall'
" c11 compatible
let g:ale_cpp_clang_options = '-std=c11 -Wall'
endif
call ale#linter#Define('cpp', {
\ 'name': 'clang',
\ 'output_stream': 'stderr',
\ 'executable': 'clang++',
\ 'command': 'clang++ -S -x c -fsyntax-only '
\ . g:ale_cpp_clang_options
\ . ' -',
\ 'callback': 'ale#handlers#HandleGCCFormat',
\})

View File

@ -26,17 +26,18 @@ CONTENTS *ale-contents*
4.14. cpp-cppcheck....................|ale-linter-options-cpp-cppcheck| 4.14. cpp-cppcheck....................|ale-linter-options-cpp-cppcheck|
4.15. htmlhint........................|ale-linter-options-htmlhint| 4.15. htmlhint........................|ale-linter-options-htmlhint|
4.16. c-clang.........................|ale-linter-options-c-clang| 4.16. c-clang.........................|ale-linter-options-c-clang|
4.17. python-flake8...................|ale-linter-options-python-flake8| 4.17. cpp-clang.......................|ale-linter-options-cpp-clang|
4.18. ruby-rubocop....................|ale-linter-options-ruby-rubocop| 4.18. python-flake8...................|ale-linter-options-python-flake8|
4.19. chktex..........................|ale-linter-options-chktex| 4.19. ruby-rubocop....................|ale-linter-options-ruby-rubocop|
4.20. lacheck.........................|ale-linter-options-lacheck| 4.20. chktex..........................|ale-linter-options-chktex|
4.21. stylelint.......................|ale-linter-options-stylelint| 4.21. lacheck.........................|ale-linter-options-lacheck|
4.22. rustc...........................|ale-linter-options-rustc| 4.22. stylelint.......................|ale-linter-options-stylelint|
4.23. python-mypy.....................|ale-linter-options-python-mypy| 4.23. rustc...........................|ale-linter-options-rustc|
4.24. python-pylint...................|ale-linter-options-python-pylint| 4.24. python-mypy.....................|ale-linter-options-python-mypy|
4.25. erlang..........................|ale-linter-options-erlang| 4.25. python-pylint...................|ale-linter-options-python-pylint|
4.26. phpmd...........................|ale-linter-options-phpmd| 4.26. erlang..........................|ale-linter-options-erlang|
4.27. xo..............................|ale-linter-options-xo| 4.27. phpmd...........................|ale-linter-options-phpmd|
4.28. xo..............................|ale-linter-options-xo|
5. Linter Integration Notes.............|ale-linter-integration| 5. Linter Integration Notes.............|ale-linter-integration|
5.1. merlin..........................|ale-linter-integration-ocaml-merlin| 5.1. merlin..........................|ale-linter-integration-ocaml-merlin|
5.2. rust.............................|ale-integration-rust| 5.2. rust.............................|ale-integration-rust|
@ -72,7 +73,7 @@ The following languages and tools are supported.
* Bash: 'shell' (-n flag), 'shellcheck' * Bash: 'shell' (-n flag), 'shellcheck'
* Bourne Shell: 'shell' (-n flag), 'shellcheck' * Bourne Shell: 'shell' (-n flag), 'shellcheck'
* C: 'cppcheck', 'gcc', 'clang' * C: 'cppcheck', 'gcc', 'clang'
* C++ (filetype cpp): 'cppcheck', 'gcc' * C++ (filetype cpp): 'cppcheck', 'gcc', 'clang'
* C#: 'mcs' * C#: 'mcs'
* Chef: 'foodcritic' * Chef: 'foodcritic'
* CoffeeScript: 'coffee', 'coffelint' * CoffeeScript: 'coffee', 'coffelint'
@ -697,7 +698,17 @@ g:ale_c_clang_options *g:ale_c_clang_options*
This variable can be change to modify flags given to clang. This variable can be change to modify flags given to clang.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
4.17. python-flake8 *ale-linter-options-python-flake8* 4.17. cpp-clang *ale-linter-options-cpp-clang*
g:ale_cpp_clang_options *g:ale_cpp_clang_options*
Type: |String|
Default: `'-std=c11 -Wall'`
This variable can be change to modify flags given to clang.
-------------------------------------------------------------------------------
4.18. python-flake8 *ale-linter-options-python-flake8*
g:ale_python_flake8_executable *g:ale_python_flake8_executable* g:ale_python_flake8_executable *g:ale_python_flake8_executable*
@ -725,7 +736,7 @@ g:ale_python_flake8_args *g:ale_python_flake8_args*
`python3 -m pip install --user flake8`). `python3 -m pip install --user flake8`).
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
4.18. ruby-rubocop *ale-linter-options-ruby-rubocop* 4.19. ruby-rubocop *ale-linter-options-ruby-rubocop*
g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options* g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options*
@ -735,7 +746,7 @@ g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options*
This variable can be change to modify flags given to rubocop. This variable can be change to modify flags given to rubocop.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
4.19. chktex *ale-linter-options-chktex* 4.20. chktex *ale-linter-options-chktex*
g:ale_tex_chktex_executable *g:ale_tex_chktex_executable* g:ale_tex_chktex_executable *g:ale_tex_chktex_executable*
@ -753,7 +764,7 @@ g:ale_tex_chktex_options *g:ale_tex_chktex_options*
This variable can be changed to modify flags given to chktex. This variable can be changed to modify flags given to chktex.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.20. lacheck *ale-linter-options-lacheck* 4.21. lacheck *ale-linter-options-lacheck*
g:ale_lacheck_executable *g:ale_lacheck_executable* g:ale_lacheck_executable *g:ale_lacheck_executable*
@ -763,7 +774,7 @@ g:ale_lacheck_executable *g:ale_lacheck_executable*
This variable can be changed to change the path to lacheck. This variable can be changed to change the path to lacheck.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
4.21. stylelint *ale-linter-options-stylelint* 4.22. stylelint *ale-linter-options-stylelint*
g:ale_css_stylelint_executable *g:ale_css_stylelint_executable* g:ale_css_stylelint_executable *g:ale_css_stylelint_executable*
@ -834,7 +845,7 @@ g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global
stylelint in node_modules. stylelint in node_modules.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.22. rustc *ale-linter-options-rustc* 4.23. rustc *ale-linter-options-rustc*
g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes*
@ -860,7 +871,7 @@ g:ale_python_mypy_options *g:ale_python_mypy_options*
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
4.24. python-pylint *ale-linter-options-python-pylint* 4.25. python-pylint *ale-linter-options-python-pylint*
g:ale_python_pylint_executable *g:ale_python_pylint_executable* g:ale_python_pylint_executable *g:ale_python_pylint_executable*
@ -888,7 +899,7 @@ g:ale_python_pylint_options *g:ale_python_pylint_options*
`python3 -m pip install --user pylint`). `python3 -m pip install --user pylint`).
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.25. erlang *ale-linter-options-erlang* 4.26. erlang *ale-linter-options-erlang*
g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* g:ale_erlang_erlc_options *g:ale_erlang_erlc_options*
@ -899,7 +910,7 @@ g:ale_erlang_erlc_options *g:ale_erlang_erlc_options*
or `-pa`. or `-pa`.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.26. phpmd *ale-linter-options-phpmd* 4.27. phpmd *ale-linter-options-phpmd*
g:ale_php_phpmd_ruleset *g:ale_php_phpmd_ruleset* g:ale_php_phpmd_ruleset *g:ale_php_phpmd_ruleset*
@ -910,7 +921,7 @@ g:ale_php_phpmd_ruleset *g:ale_php_phpmd_ruleset*
the available phpmd rulesets the available phpmd rulesets
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.27. xo *ale-linter-options-xo* 4.28. xo *ale-linter-options-xo*
g:ale_javascript_xo_executable *g:ale_javascript_xo_executable* g:ale_javascript_xo_executable *g:ale_javascript_xo_executable*