From 2ef1d9ac64a16a75aa898d2a9e714c1971737b4d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 21:30:45 +0100 Subject: [PATCH] build(deps): bump github.com/mgechev/revive from 1.3.6 to 1.3.7 (#4355) Co-authored-by: Fernandez Ludovic --- .golangci.reference.yml | 9 +++++++-- go.mod | 2 +- go.sum | 4 ++-- pkg/commands/version.go | 2 +- pkg/golinters/gochecksumtype.go | 2 +- pkg/golinters/revive.go | 5 +++-- pkg/golinters/stylecheck.go | 2 +- pkg/golinters/unused.go | 2 +- pkg/golinters/varcheck.go | 2 +- pkg/golinters/whitespace.go | 2 +- pkg/lint/linter/config.go | 2 +- test/testshared/analysis.go | 2 +- 12 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 383e5633f4e8..be547461a2b0 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1734,8 +1734,8 @@ linters-settings: disabled: false arguments: - "^[a-z][a-z0-9]{0,}$" - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#imports-blacklist - - name: imports-blacklist + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#imports-blocklist + - name: imports-blocklist severity: warning disabled: false arguments: @@ -1750,6 +1750,11 @@ linters-settings: severity: warning disabled: false arguments: [ 80 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-control-nesting + - name: max-control-nesting + severity: warning + disabled: false + arguments: [ 3 ] # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-public-structs - name: max-public-structs severity: warning diff --git a/go.mod b/go.mod index 36319380d276..5cf9d88de91e 100644 --- a/go.mod +++ b/go.mod @@ -75,7 +75,7 @@ require ( github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 github.com/mattn/go-colorable v0.1.13 github.com/mbilski/exhaustivestruct v1.2.0 - github.com/mgechev/revive v1.3.6 + github.com/mgechev/revive v1.3.7 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-ps v1.0.0 github.com/moricho/tparallel v0.3.1 diff --git a/go.sum b/go.sum index fe5f3f1e821a..387627245dc9 100644 --- a/go.sum +++ b/go.sum @@ -376,8 +376,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/revive v1.3.6 h1:ZNKZiHb/LciAqzwa/9HnwI8S/OJutYhMvaqgMT1Ylgo= -github.com/mgechev/revive v1.3.6/go.mod h1:75Je+5jKBgdgADNzGhsq7H5J6CmyXSzEk9eLOU4i8Pg= +github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= +github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= diff --git a/pkg/commands/version.go b/pkg/commands/version.go index bb7732250f5d..10ab7c1bb1b1 100644 --- a/pkg/commands/version.go +++ b/pkg/commands/version.go @@ -38,7 +38,7 @@ func (e *Executor) initVersion() { Short: "Version", Args: cobra.NoArgs, ValidArgsFunction: cobra.NoFileCompletions, - RunE: func(cmd *cobra.Command, _ []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if e.cfg.Version.Debug { info, ok := debug.ReadBuildInfo() if !ok { diff --git a/pkg/golinters/gochecksumtype.go b/pkg/golinters/gochecksumtype.go index fcc0cad5889e..5516179dfccb 100644 --- a/pkg/golinters/gochecksumtype.go +++ b/pkg/golinters/gochecksumtype.go @@ -45,7 +45,7 @@ func NewGoCheckSumType() *goanalysis.Linter { `Run exhaustiveness checks on Go "sum types"`, []*analysis.Analyzer{analyzer}, nil, - ).WithIssuesReporter(func(ctx *linter.Context) []goanalysis.Issue { + ).WithIssuesReporter(func(_ *linter.Context) []goanalysis.Issue { return resIssues }).WithLoadMode(goanalysis.LoadModeTypesInfo) } diff --git a/pkg/golinters/revive.go b/pkg/golinters/revive.go index 213359cae362..46d8b1c9caf9 100644 --- a/pkg/golinters/revive.go +++ b/pkg/golinters/revive.go @@ -247,7 +247,7 @@ func safeTomlSlice(r []any) []any { } // This element is not exported by revive, so we need copy the code. -// Extracted from https://github.com/mgechev/revive/blob/v1.3.5/config/config.go#L15 +// Extracted from https://github.com/mgechev/revive/blob/v1.3.7/config/config.go#L15 var defaultRules = []lint.Rule{ &rule.VarDeclarationsRule{}, &rule.PackageCommentsRule{}, @@ -290,7 +290,7 @@ var allRules = append([]lint.Rule{ &rule.ModifiesValRecRule{}, &rule.ConstantLogicalExprRule{}, &rule.BoolLiteralRule{}, - &rule.ImportsBlacklistRule{}, + &rule.ImportsBlocklistRule{}, &rule.FunctionResultsLimitRule{}, &rule.MaxPublicStructsRule{}, &rule.RangeValInClosureRule{}, @@ -329,6 +329,7 @@ var allRules = append([]lint.Rule{ &rule.EnforceMapStyleRule{}, &rule.EnforceRepeatedArgTypeStyleRule{}, &rule.EnforceSliceStyleRule{}, + &rule.MaxControlNestingRule{}, }, defaultRules...) const defaultConfidence = 0.8 diff --git a/pkg/golinters/stylecheck.go b/pkg/golinters/stylecheck.go index 2e1e21c5bdbb..d9b0f87c87d1 100644 --- a/pkg/golinters/stylecheck.go +++ b/pkg/golinters/stylecheck.go @@ -15,7 +15,7 @@ func NewStylecheck(settings *config.StaticCheckSettings) *goanalysis.Linter { // `scconfig.Analyzer` is a singleton, then it's not possible to have more than one instance for all staticcheck "sub-linters". // When we will merge the 4 "sub-linters", the problem will disappear: https://github.com/golangci/golangci-lint/issues/357 // Currently only stylecheck analyzer has a configuration in staticcheck. - scconfig.Analyzer.Run = func(pass *analysis.Pass) (any, error) { + scconfig.Analyzer.Run = func(_ *analysis.Pass) (any, error) { return cfg, nil } diff --git a/pkg/golinters/unused.go b/pkg/golinters/unused.go index 89ae7e98a2e1..a93061c96c33 100644 --- a/pkg/golinters/unused.go +++ b/pkg/golinters/unused.go @@ -47,7 +47,7 @@ func NewUnused(settings *config.UnusedSettings, scSettings *config.StaticCheckSe "Checks Go code for unused constants, variables, functions and types", []*analysis.Analyzer{analyzer}, nil, - ).WithIssuesReporter(func(lintCtx *linter.Context) []goanalysis.Issue { + ).WithIssuesReporter(func(_ *linter.Context) []goanalysis.Issue { return resIssues }).WithLoadMode(goanalysis.LoadModeTypesInfo) } diff --git a/pkg/golinters/varcheck.go b/pkg/golinters/varcheck.go index 495c5b59fb9e..ea735672f62f 100644 --- a/pkg/golinters/varcheck.go +++ b/pkg/golinters/varcheck.go @@ -30,7 +30,7 @@ func NewVarcheck(settings *config.VarCheckSettings) *goanalysis.Linter { "Finds unused global variables and constants", []*analysis.Analyzer{analyzer}, nil, - ).WithContextSetter(func(lintCtx *linter.Context) { + ).WithContextSetter(func(_ *linter.Context) { analyzer.Run = func(pass *analysis.Pass) (any, error) { issues := runVarCheck(pass, settings) diff --git a/pkg/golinters/whitespace.go b/pkg/golinters/whitespace.go index 8fef6be9adf7..5487b1016ab9 100644 --- a/pkg/golinters/whitespace.go +++ b/pkg/golinters/whitespace.go @@ -35,7 +35,7 @@ func NewWhitespace(settings *config.WhitespaceSettings) *goanalysis.Linter { a.Doc, []*analysis.Analyzer{a}, nil, - ).WithContextSetter(func(lintCtx *linter.Context) { + ).WithContextSetter(func(_ *linter.Context) { a.Run = func(pass *analysis.Pass) (any, error) { issues, err := runWhitespace(pass, wsSettings) if err != nil { diff --git a/pkg/lint/linter/config.go b/pkg/lint/linter/config.go index 94ec8e891856..ed5e5508ceab 100644 --- a/pkg/lint/linter/config.go +++ b/pkg/lint/linter/config.go @@ -138,7 +138,7 @@ func (lc *Config) WithNoopFallback(cfg *config.Config) *Config { lc.Linter = &Noop{ name: lc.Linter.Name(), desc: lc.Linter.Desc(), - run: func(pass *analysis.Pass) (any, error) { + run: func(_ *analysis.Pass) (any, error) { return nil, nil }, } diff --git a/test/testshared/analysis.go b/test/testshared/analysis.go index 9ef29fd81e02..3bc1d8e08898 100644 --- a/test/testshared/analysis.go +++ b/test/testshared/analysis.go @@ -110,7 +110,7 @@ func parseComments(sourcePath string, fileData []byte) (map[key][]expectation, e func parseExpectations(text string) (lineDelta int, expects []expectation, err error) { var scanErr string sc := new(scanner.Scanner).Init(strings.NewReader(text)) - sc.Error = func(s *scanner.Scanner, msg string) { + sc.Error = func(_ *scanner.Scanner, msg string) { scanErr = msg // e.g. bad string escape } sc.Mode = scanner.ScanIdents | scanner.ScanStrings | scanner.ScanRawStrings | scanner.ScanInts