dev: deprecate errcheck.ignore option (#4709)

This commit is contained in:
Oleksandr Redko 2024-05-09 00:01:54 +03:00 committed by GitHub
parent e89b55c015
commit 565c81fa8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View File

@ -167,6 +167,9 @@ issues:
- path: pkg/golinters/errcheck/errcheck.go
linters: [staticcheck]
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
- path: pkg/golinters/errcheck/errcheck.go
linters: [staticcheck]
text: "SA1019: errCfg.Ignore is deprecated: use ExcludeFunctions instead"
- path: pkg/golinters/govet/govet.go
linters: [staticcheck]
text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable."

View File

@ -371,11 +371,13 @@ type ErrcheckSettings struct {
DisableDefaultExclusions bool `mapstructure:"disable-default-exclusions"`
CheckTypeAssertions bool `mapstructure:"check-type-assertions"`
CheckAssignToBlank bool `mapstructure:"check-blank"`
Ignore string `mapstructure:"ignore"`
ExcludeFunctions []string `mapstructure:"exclude-functions"`
// Deprecated: use ExcludeFunctions instead
Exclude string `mapstructure:"exclude"`
// Deprecated: use ExcludeFunctions instead
Ignore string `mapstructure:"ignore"`
}
type ErrChkJSONSettings struct {

View File

@ -355,6 +355,7 @@ func (l *Loader) handleDeprecation() error {
return nil
}
//nolint:gocyclo // the complexity cannot be reduced.
func (l *Loader) handleLinterOptionDeprecations() {
// Deprecated since v1.57.0,
// but it was unofficially deprecated since v1.19 (2019) (https://github.com/golangci/golangci-lint/pull/697).
@ -373,6 +374,12 @@ func (l *Loader) handleLinterOptionDeprecations() {
l.log.Warnf("The configuration option `linters.errcheck.exclude` is deprecated, please use `linters.errcheck.exclude-functions`.")
}
// Deprecated since v1.59.0,
// but it was unofficially deprecated since v1.13 (2018) (https://github.com/golangci/golangci-lint/pull/332).
if l.cfg.LintersSettings.Errcheck.Ignore != "" {
l.log.Warnf("The configuration option `linters.errcheck.ignore` is deprecated, please use `linters.errcheck.exclude-functions`.")
}
// Deprecated since v1.44.0.
if l.cfg.LintersSettings.Gci.LocalPrefixes != "" {
l.log.Warnf("The configuration option `linters.gci.local-prefixes` is deprecated, please use `prefix()` inside `linters.gci.sections`.")