Skip to content

Commit

Permalink
build(deps): bump github.com/mgechev/revive from 1.2.1 to 1.2.2 (gola…
Browse files Browse the repository at this point in the history
…ngci#3075)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
  • Loading branch information
2 people authored and SeigeC committed Apr 4, 2023
1 parent 08cac12 commit ab79c81
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 50 deletions.
4 changes: 4 additions & 0 deletions .golangci.reference.yml
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/config/issues.go
Expand Up @@ -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",
},
Expand Down
53 changes: 11 additions & 42 deletions pkg/golinters/revive.go
Expand Up @@ -7,7 +7,6 @@ import (
"go/token"
"os"
"reflect"
"strings"
"sync"

"github.com/BurntSushi/toml"
Expand Down Expand Up @@ -183,7 +182,6 @@ func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) {
}

normalizeConfig(conf)
ignoreRules(conf)

reviveDebugf("revive configuration: %#v", conf)

Expand Down Expand Up @@ -252,23 +250,23 @@ 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{},
&rule.ExportedRule{},
&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{},
}

Expand All @@ -289,15 +287,15 @@ 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{},
&rule.ImportsBlacklistRule{},
&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{},
Expand All @@ -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{},
Expand All @@ -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
Expand Down Expand Up @@ -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, ","))
}
}

0 comments on commit ab79c81

Please sign in to comment.