Add cpp linter (#64)

* Add c gcc option in the doc

* Add missing tag for eslint option in the doc

* Correct typo in doc (' ' instead of '.')

* add cpp linter

* correct typo in doc

* add filetype information for c++
This commit is contained in:
Marc Delage 2016-10-08 13:42:36 +02:00 committed by w0rp
parent bd6da4489d
commit edc5cedd8c
3 changed files with 36 additions and 0 deletions

View File

@ -29,6 +29,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 | [gcc](https://gcc.gnu.org/) | | C | [gcc](https://gcc.gnu.org/) |
| C++ (filetype cpp)| [gcc](https://gcc.gnu.org/) |
| CoffeeScript | [coffeelint](https://www.npmjs.com/package/coffeelint) | | CoffeeScript | [coffeelint](https://www.npmjs.com/package/coffeelint) |
| CSS | [csslint](http://csslint.net/) | | CSS | [csslint](http://csslint.net/) |
| Cython (pyrex filetype) | [cython](http://cython.org/) | | Cython (pyrex filetype) | [cython](http://cython.org/) |

23
ale_linters/cpp/gcc.vim Normal file
View File

@ -0,0 +1,23 @@
" Author: geam <mdelage@student.42.fr>
" Description: gcc linter for cpp files
if exists('g:loaded_ale_linters_cpp_gcc')
finish
endif
let g:loaded_ale_linters_cpp_gcc = 1
" Set this option to change the GCC options for warnings for C.
if !exists('g:ale_cpp_gcc_options')
let g:ale_cpp_gcc_options = '-Wall'
endif
call ALEAddLinter('cpp', {
\ 'name': 'gcc',
\ 'output_stream': 'stderr',
\ 'executable': 'gcc',
\ 'command': 'gcc -S -x c++ -fsyntax-only '
\ . g:ale_cpp_gcc_options
\ . ' -',
\ 'callback': 'ale#handlers#HandleGCCFormat',
\})

View File

@ -13,6 +13,7 @@ CONTENTS *ale-contents*
4.1. eslint.....................................|ale-linter-options-eslint| 4.1. eslint.....................................|ale-linter-options-eslint|
4.2. phpcs......................................|ale-linter-options-phpcs| 4.2. phpcs......................................|ale-linter-options-phpcs|
4.3. c-gcc......................................|ale-linter-options-c-gcc| 4.3. c-gcc......................................|ale-linter-options-c-gcc|
4.4. cpp-gcc....................................|ale-linter-options-cpp-gcc|
5. API............................................|ale-api| 5. API............................................|ale-api|
6. Contact........................................|ale-contact| 6. Contact........................................|ale-contact|
@ -42,6 +43,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: 'gcc' * C: 'gcc'
* C++ (filetype cpp): 'gcc'
* CoffeeScript: 'coffelint' * CoffeeScript: 'coffelint'
* CSS: 'csslint' * CSS: 'csslint'
* Cython (pyrex filetype): 'cython' * Cython (pyrex filetype): 'cython'
@ -274,6 +276,16 @@ Default: `'-Wall'`
This variable can be change to modify flags given to gcc. This variable can be change to modify flags given to gcc.
-------------------------------------------------------------------------------
4.4. cpp-gcc *ale-linter-options-cpp-gcc*
g:ale_cpp_gcc_options *g:ale_cpp_gcc_options*
Type: |String|
Default: `'-Wall'`
This variable can be changed to modify flags given to gcc.
=============================================================================== ===============================================================================
5. API *ale-api* 5. API *ale-api*