summaryrefslogtreecommitdiff
path: root/ale_linters/go/revive.vim
diff options
context:
space:
mode:
authorPaco <liaoishere@gmail.com>2020-05-22 19:09:14 +0800
committerGitHub <noreply@github.com>2020-05-22 06:09:14 -0500
commit7265ceb6d050d1a4642741d248f11e4f2abd37e1 (patch)
treec4d8dd7e708a201a080efb2ddc63f9b49132c7f1 /ale_linters/go/revive.vim
parent7ff87a942b8a6c2cf50b7cf34f9b98421508f542 (diff)
downloadale-7265ceb6d050d1a4642741d248f11e4f2abd37e1.zip
Support revive for go files (#2933)
Signed-off-by: Penghui Liao <liaoishere@gmail.com>
Diffstat (limited to 'ale_linters/go/revive.vim')
-rw-r--r--ale_linters/go/revive.vim21
1 files changed, 21 insertions, 0 deletions
diff --git a/ale_linters/go/revive.vim b/ale_linters/go/revive.vim
new file mode 100644
index 00000000..b14b5ab9
--- /dev/null
+++ b/ale_linters/go/revive.vim
@@ -0,0 +1,21 @@
+" Author: Penghui Liao <liaoishere@gmail.com>
+" Description: Adds support for revive
+
+call ale#Set('go_revive_executable', 'revive')
+call ale#Set('go_revive_options', '')
+
+function! ale_linters#go#revive#GetCommand(buffer) abort
+ let l:options = ale#Var(a:buffer, 'go_revive_options')
+
+ return ale#go#EnvString(a:buffer) . '%e'
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' %t'
+endfunction
+
+call ale#linter#Define('go', {
+\ 'name': 'revive',
+\ 'output_stream': 'both',
+\ 'executable': {b -> ale#Var(b, 'go_revive_executable')},
+\ 'command': function('ale_linters#go#revive#GetCommand'),
+\ 'callback': 'ale#handlers#unix#HandleAsWarning',
+\})