mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-22 17:48:37 +08:00
Add buf linter and fixer (#4128)
* Add buf lint to linters * Add buf format to fixers * Fix test/linter/test_buf_lint.vader * Fix test/fixers/test_buf_format_fixer_callback.vader * Simplify test/test-files/proto/testfile.proto * Add buf-lint alias and rename linter
This commit is contained in:
23
ale_linters/proto/buf_lint.vim
Normal file
23
ale_linters/proto/buf_lint.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: Alex McKinney <alexmckinney01@gmail.com>
|
||||
" Description: Run buf lint.
|
||||
|
||||
call ale#Set('proto_buf_lint_executable', 'buf')
|
||||
call ale#Set('proto_buf_lint_config', '')
|
||||
|
||||
function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
|
||||
let l:config = ale#Var(a:buffer, 'proto_buf_lint_config')
|
||||
|
||||
return '%e lint'
|
||||
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
|
||||
\ . ' %s#include_package_files=true'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('proto', {
|
||||
\ 'name': 'buf_lint',
|
||||
\ 'aliases': ['buf-lint'],
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'proto_buf_lint_executable')},
|
||||
\ 'command': function('ale_linters#proto#buf_lint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
Reference in New Issue
Block a user