From ab79c81b2cb2bf8ceaf7661a2d35a3c47099b220 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 Aug 2022 13:57:17 +0200 Subject: [PATCH] build(deps): bump github.com/mgechev/revive from 1.2.1 to 1.2.2 (#3075) Co-authored-by: Fernandez Ludovic --- .golangci.reference.yml | 4 ++++ go.mod | 4 ++-- go.sum | 9 ++++--- pkg/config/issues.go | 2 +- pkg/golinters/revive.go | 53 +++++++++-------------------------------- 5 files changed, 22 insertions(+), 50 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index fa61070c6af3..080be7125b58 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -1341,6 +1341,10 @@ linters-settings: severity: warning disabled: false arguments: [ 3 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#datarace + - name: datarace + severity: warning + disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit - name: deep-exit severity: warning diff --git a/go.mod b/go.mod index 51bb5db6e653..9f8c0550ddda 100644 --- a/go.mod +++ b/go.mod @@ -61,7 +61,7 @@ require ( github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // v1.0 github.com/mattn/go-colorable v0.1.12 github.com/mbilski/exhaustivestruct v1.2.0 - github.com/mgechev/revive v1.2.1 + github.com/mgechev/revive v1.2.2 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-ps v1.0.0 github.com/moricho/tparallel v0.2.1 @@ -114,7 +114,7 @@ require ( github.com/Masterminds/semver v1.5.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 // indirect + github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/ettle/strcase v0.1.1 // indirect github.com/fatih/structtag v1.2.0 // indirect diff --git a/go.sum b/go.sum index a27b29d18c29..620bc121ff0e 100644 --- a/go.sum +++ b/go.sum @@ -48,7 +48,6 @@ github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0S github.com/Antonboom/nilnil v0.1.1 h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q= github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -108,8 +107,8 @@ github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cb github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= -github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 h1:tFXjAxje9thrTF4h57Ckik+scJjTWdwAtZqZPtOT48M= -github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4/go.mod h1:W8EnPSQ8Nv4fUjc/v1/8tHFqhuOJXnRub0dTfuAQktU= +github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 h1:E7LT642ysztPWE0dfz43cWOvMiF42DyTRC+eZIaO4yI= +github.com/chavacava/garif v0.0.0-20220630083739-93517212f375/go.mod h1:4m1Rv7xfuwWPNKXlThldNuJvutYM6J95wNuuVmn55To= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -460,8 +459,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 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/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= -github.com/mgechev/revive v1.2.1 h1:GjFml7ZsoR0IrQ2E2YIvWFNS5GPDV7xNwvA5GM1HZC4= -github.com/mgechev/revive v1.2.1/go.mod h1:+Ro3wqY4vakcYNtkBWdZC7dBg1xSB6sp054wWwmeFm0= +github.com/mgechev/revive v1.2.2 h1:Cr79eeJ0xslhV9HjaEIdZLjUXl2zFzSu+Kx5XGjH8xM= +github.com/mgechev/revive v1.2.2/go.mod h1:AqmPmem7b5NU69DdRzn5U6czfv7tzXMjjLmZUlk8xOw= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= diff --git a/pkg/config/issues.go b/pkg/config/issues.go index 0f9ac5f61d83..a56823eed8d7 100644 --- a/pkg/config/issues.go +++ b/pkg/config/issues.go @@ -97,7 +97,7 @@ var DefaultExcludePatterns = []ExcludePattern{ }, { ID: "EXC0015", - Pattern: `should have a package comment, unless it's in another file for this package`, + Pattern: `should have a package comment`, Linter: "revive", Why: "Annoying issue about not having a comment. The rare codebase has such comments", }, diff --git a/pkg/golinters/revive.go b/pkg/golinters/revive.go index 906e1c3ef44d..5c160665f52b 100644 --- a/pkg/golinters/revive.go +++ b/pkg/golinters/revive.go @@ -7,7 +7,6 @@ import ( "go/token" "os" "reflect" - "strings" "sync" "github.com/BurntSushi/toml" @@ -183,7 +182,6 @@ func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) { } normalizeConfig(conf) - ignoreRules(conf) reviveDebugf("revive configuration: %#v", conf) @@ -252,7 +250,7 @@ func safeTomlSlice(r []interface{}) []interface{} { // This element is not exported by revive, so we need copy the code. // Extracted from https://github.com/mgechev/revive/blob/v1.1.4/config/config.go#L15 var defaultRules = []lint.Rule{ - // &rule.VarDeclarationsRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (var-declaration) + &rule.VarDeclarationsRule{}, &rule.PackageCommentsRule{}, &rule.DotImportsRule{}, &rule.BlankImportsRule{}, @@ -260,15 +258,15 @@ var defaultRules = []lint.Rule{ &rule.VarNamingRule{}, &rule.IndentErrorFlowRule{}, &rule.RangeRule{}, - // &rule.ErrorfRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (errorf + &rule.ErrorfRule{}, &rule.ErrorNamingRule{}, &rule.ErrorStringsRule{}, &rule.ReceiverNamingRule{}, &rule.IncrementDecrementRule{}, &rule.ErrorReturnRule{}, - // &rule.UnexportedReturnRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (unexported-return) - // &rule.TimeNamingRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (time-naming) - // &rule.ContextKeysType{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (context-keys-type) + &rule.UnexportedReturnRule{}, + &rule.TimeNamingRule{}, + &rule.ContextKeysType{}, &rule.ContextAsArgumentRule{}, } @@ -289,7 +287,7 @@ var allRules = append([]lint.Rule{ &rule.FlagParamRule{}, &rule.UnnecessaryStmtRule{}, &rule.StructTagRule{}, - // &rule.ModifiesValRecRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (modifies-value-receiver) + &rule.ModifiesValRecRule{}, &rule.ConstantLogicalExprRule{}, &rule.BoolLiteralRule{}, &rule.RedefinesBuiltinIDRule{}, @@ -297,7 +295,7 @@ var allRules = append([]lint.Rule{ &rule.FunctionResultsLimitRule{}, &rule.MaxPublicStructsRule{}, &rule.RangeValInClosureRule{}, - // &rule.RangeValAddress{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (range-val-address) + &rule.RangeValAddress{}, &rule.WaitGroupByValueRule{}, &rule.AtomicRule{}, &rule.EmptyLinesRule{}, @@ -307,9 +305,9 @@ var allRules = append([]lint.Rule{ &rule.ImportShadowingRule{}, &rule.BareReturnRule{}, &rule.UnusedReceiverRule{}, - // &rule.UnhandledErrorRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (unhandled-error) + &rule.UnhandledErrorRule{}, &rule.CognitiveComplexityRule{}, - // &rule.StringOfIntRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (string-of-int) + &rule.StringOfIntRule{}, &rule.StringFormatRule{}, &rule.EarlyReturnRule{}, &rule.UnconditionalRecursionRule{}, @@ -320,9 +318,10 @@ var allRules = append([]lint.Rule{ &rule.NestedStructs{}, &rule.IfReturnRule{}, &rule.UselessBreak{}, - // &rule.TimeEqualRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (time-equal) + &rule.TimeEqualRule{}, &rule.BannedCharsRule{}, &rule.OptimizeOperandsOrderRule{}, + &rule.DataRaceRule{}, }, defaultRules...) const defaultConfidence = 0.8 @@ -386,33 +385,3 @@ func defaultConfig() *lint.Config { } return &defaultConfig } - -// TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 -func ignoreRules(conf *lint.Config) { - f := []string{ - "context-keys-type", - "errorf", - "modifies-value-receiver", - "range-val-address", - "string-of-int", - "time-equal", - "time-naming", - "unexported-return", - "unhandled-error", - "var-declaration", - } - - var ignored []string - for _, s := range f { - 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, ",")) - } -}