summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authoryohei yoshimuta <yoheimuta@gmail.com>2021-04-09 22:16:23 +0900
committerGitHub <noreply@github.com>2021-04-09 22:16:23 +0900
commitcec9954d016e4d388cd6a9abed798de7f330d185 (patch)
treec060a1b598d161da466c6ef78f4442b44a6f1bc3 /ale_linters
parentf0887d3e6178482255f11aa378124aef3699245f (diff)
downloadale-cec9954d016e4d388cd6a9abed798de7f330d185.zip
feat: Add protolint as linter and fixer (#2911)
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/proto/protolint.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/ale_linters/proto/protolint.vim b/ale_linters/proto/protolint.vim
new file mode 100644
index 00000000..2754c7b6
--- /dev/null
+++ b/ale_linters/proto/protolint.vim
@@ -0,0 +1,24 @@
+" Author: Yohei Yoshimuta <yoheimuta@gmail.com>
+" Description: run the protolint for Protocol Buffer files
+
+call ale#Set('proto_protolint_executable', 'protolint')
+call ale#Set('proto_protolint_config', '')
+
+function! ale_linters#proto#protolint#GetCommand(buffer) abort
+ let l:config = ale#Var(a:buffer, 'proto_protolint_config')
+
+ return '%e lint'
+ \ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '')
+ \ . ' -reporter=unix'
+ \ . ' %s'
+endfunction
+
+call ale#linter#Define('proto', {
+\ 'name': 'protolint',
+\ 'lint_file': 1,
+\ 'output_stream': 'stderr',
+\ 'executable': {b -> ale#Var(b, 'proto_protolint_executable')},
+\ 'command': function('ale_linters#proto#protolint#GetCommand'),
+\ 'callback': 'ale#handlers#unix#HandleAsError',
+\})
+