2022-04-06 08:00:59 +00:00
|
|
|
" 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', '')
|
2022-09-08 08:04:17 +00:00
|
|
|
call ale#Set('proto_buf_lint_options', '')
|
2022-04-06 08:00:59 +00:00
|
|
|
|
|
|
|
function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
|
|
|
|
let l:config = ale#Var(a:buffer, 'proto_buf_lint_config')
|
2022-09-08 08:04:17 +00:00
|
|
|
let l:options = ale#Var(a:buffer, 'proto_buf_lint_options')
|
2022-04-06 08:00:59 +00:00
|
|
|
|
|
|
|
return '%e lint'
|
|
|
|
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
|
2022-09-08 08:04:17 +00:00
|
|
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
2022-04-06 08:00:59 +00:00
|
|
|
\ . ' %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'),
|
2022-09-08 08:04:17 +00:00
|
|
|
\ 'callback': 'ale#handlers#go#Handler',
|
2022-04-06 08:00:59 +00:00
|
|
|
\})
|