diff --git a/pkg/lint/linter/config.go b/pkg/lint/linter/config.go index 4ec835254f7d..86f78e5a4b8e 100644 --- a/pkg/lint/linter/config.go +++ b/pkg/lint/linter/config.go @@ -22,10 +22,11 @@ type Config struct { InPresets []string AlternativeNames []string - OriginalURL string // URL of original (not forked) repo, needed for autogenerated README - CanAutoFix bool - IsSlow bool - DoesChangeTypes bool + OriginalURL string // URL of original (not forked) repo, needed for autogenerated README + CanAutoFix bool + IsSlow bool + DoesChangeTypes bool + DeprecatedMessage string } func (lc *Config) ConsiderSlow() *Config { @@ -73,6 +74,15 @@ func (lc *Config) WithChangeTypes() *Config { return lc } +func (lc *Config) Deprecated(message string) *Config { + lc.DeprecatedMessage = message + return lc +} + +func (lc *Config) IsDeprecated() bool { + return lc.DeprecatedMessage != "" +} + func (lc *Config) AllNames() []string { return append([]string{lc.Name()}, lc.AlternativeNames...) } diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index bdf7a870441b..035ab151c626 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -177,7 +177,8 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { linter.NewConfig(golinters.NewInterfacer()). WithLoadForGoAnalysis(). WithPresets(linter.PresetStyle). - WithURL("https://github.com/mvdan/interfacer"), + WithURL("https://github.com/mvdan/interfacer"). + Deprecated("The repository of the linter has been archived by the owner."), linter.NewConfig(golinters.NewUnconvert()). WithLoadForGoAnalysis(). WithPresets(linter.PresetStyle). diff --git a/pkg/lint/runner.go b/pkg/lint/runner.go index 63e6ad710742..9f27da884f20 100644 --- a/pkg/lint/runner.go +++ b/pkg/lint/runner.go @@ -50,6 +50,13 @@ func NewRunner(cfg *config.Config, log logutils.Log, goenv *goutil.Env, es *lint return nil, errors.Wrap(err, "failed to get enabled linters") } + // print deprecated messages + for name, lc := range enabledLinters { + if lc.IsDeprecated() { + log.Warnf("The linter '%s' is deprecated due to: %s", name, lc.DeprecatedMessage) + } + } + return &Runner{ Processors: []processors.Processor{ processors.NewCgo(goenv),