From 85d4505315bb99c1e213c1196624eef824afd594 Mon Sep 17 00:00:00 2001 From: Micah Coffman Date: Wed, 20 Mar 2019 17:40:21 -0400 Subject: [PATCH] add g:go_metalinter_config_enabled and g:go_metalinter_grep_new flags --- autoload/go/config.vim | 8 ++++++++ autoload/go/lint.vim | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 5435cac488..204bf590ff 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -244,6 +244,14 @@ function! go#config#Metalinter() abort return get(g:, "go_metalinter", "gometalinter") endfunction +function! go#config#MetalinterConfigEnabled() abort + return get(g:, "go_metalinter_config_enabled", 0) +endfunction + +function! go#config#MetalinterGrepNew() abort + return get(g:, "go_metalinter_grep_new", 0) +endfunction + function! go#config#MetalinterCommand() abort return get(g:, "go_metalinter_command", "") endfunction diff --git a/autoload/go/lint.vim b/autoload/go/lint.vim index 8643c86ae7..418de412b0 100644 --- a/autoload/go/lint.vim +++ b/autoload/go/lint.vim @@ -255,7 +255,14 @@ function! s:golangcilintcmd(bin_path) let cmd = [a:bin_path] let cmd += ["run"] let cmd += ["--print-issued-lines=false"] - let cmd += ["--disable-all"] + + if go#config#MetalinterConfigEnabled() == 0 + let cmd += ["--no-config"] + let cmd += ["--disable-all"] + if go#config#MetalinterGrepNew() == 1 + let cmd += ["--new-from-rev=HEAD~"] + endif + return cmd endfunction