From 512ac9f7f79cdb6e6b89fdd4cf75e8c6b3c61970 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 21 Jul 2022 00:43:20 +0200 Subject: [PATCH] revice: add log for ignored rules --- pkg/golinters/revive.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/golinters/revive.go b/pkg/golinters/revive.go index 30a9ddf062f6..0e150720c50c 100644 --- a/pkg/golinters/revive.go +++ b/pkg/golinters/revive.go @@ -7,6 +7,7 @@ import ( "go/token" "os" "reflect" + "strings" "sync" "github.com/BurntSushi/toml" @@ -405,7 +406,17 @@ func ignoreRules(conf *lint.Config) { "var-declaration", } + var ignored []string for _, s := range f { - delete(conf.Rules, s) + if _, ok := conf.Rules[s]; ok { + delete(conf.Rules, s) + ignored = append(ignored, s) + } + } + + if len(ignored) > 0 { + linterLogger.Warnf("revive: the following rules (%s) are ignored due to a performance problem "+ + "(https://github.com/golangci/golangci-lint/issues/2997)", + strings.Join(ignored, ",")) } }