summaryrefslogtreecommitdiff
path: root/ale_linters/proto/buf_lint.vim
blob: a22f8e5342e13d16c68ce51273d3d114ac3405d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
" 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', '')
call ale#Set('proto_buf_lint_options', '')

function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
    let l:config = ale#Var(a:buffer, 'proto_buf_lint_config')
    let l:options = ale#Var(a:buffer, 'proto_buf_lint_options')

    return '%e lint'
    \ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
    \ . (!empty(l:options) ? ' ' . l:options : '')
    \ . ' %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#go#Handler',
\})