Skip to content

build(deps): bump github.com/mgechev/revive from 1.2.1 to 1.2.2 #3075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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, ","))
}
}