enable using cpplint for c (#3008)

* enable using cpplint for c

* fix tag alignment

* fix tag alignment trial #2

Co-authored-by: Justin Huang <justin.huang@perceive.io>
This commit is contained in:
Justin Huang 2022-02-03 06:32:42 -07:00 committed by GitHub
parent a81512cfd2
commit d1e2aaf85d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

20
ale_linters/c/cpplint.vim Normal file
View File

@ -0,0 +1,20 @@
" Author: Justin Huang <justin.y.huang@live.com>
" Description: cpplint for c files
call ale#Set('c_cpplint_executable', 'cpplint')
call ale#Set('c_cpplint_options', '')
function! ale_linters#c#cpplint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'c_cpplint_options')
return '%e' . ale#Pad(l:options) . ' %s'
endfunction
call ale#linter#Define('c', {
\ 'name': 'cpplint',
\ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')},
\ 'command': function('ale_linters#c#cpplint#GetCommand'),
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
\ 'lint_file': 1,
\})

View File

@ -287,6 +287,21 @@ g:ale_cpp_cpplint_options *g:ale_cpp_cpplint_options*
This variable can be changed to modify flags given to cpplint.
g:ale_c_cpplint_executable *g:ale_c_cpplint_executable*
*b:ale_c_cpplint_executable*
Type: |String|
Default: `'cpplint'`
This variable can be changed to use a different executable for cpplint.
g:ale_c_cpplint_options *g:ale_c_cpplint_options*
*b:ale_c_cpplint_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to cpplint.
===============================================================================
cquery *ale-cpp-cquery*