revive: ignore slow rules (#2999)
Some checks failed
Release a tag / release (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile.alpine]) (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile]) (push) Has been cancelled
Some checks failed
Release a tag / release (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile.alpine]) (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile]) (push) Has been cancelled
This commit is contained in:
parent
3fb60a3e8a
commit
61673b3436
34
CHANGELOG.md
34
CHANGELOG.md
@ -16,27 +16,27 @@ There is the most valuable changes log:
|
||||
* `asasalint`: https://github.com/alingse/asasalint
|
||||
* `nosnakecase`: https://github.com/sivchari/nosnakecase
|
||||
2. updated linters:
|
||||
* `errname`: from 0.1.6 to 0.1.7
|
||||
* `gci`: from 0.3.4 to 0.4.2
|
||||
* `nonamedreturns`: from 1.0.1 to 1.0.4
|
||||
* `gocyclo`: from 0.5.1 to 0.6.0
|
||||
* `go-exhaustruct`: from 2.1.0 to 2.2.0
|
||||
* `errcheck`: from 1.6.0 to 1.6.1
|
||||
* `thelper`: from 0.6.2 to 0.6.3
|
||||
* `paralleltest`: from 1.0.3 to 1.0.6
|
||||
* `testpackage`: from 1.0.1 to 1.1.0
|
||||
* `exhaustive`: from 0.7.11 to 0.8.1
|
||||
* `go-ruleguard`: from 0.3.19 to 0.3.21
|
||||
* `gosec`: from 2.11.0 to 2.12.0
|
||||
* `tenv`: from 1.5.0 to 1.6.0
|
||||
* `wrapcheck`: from 2.6.1 to 2.6.2
|
||||
* `gocognit`: from 1.0.5 to 1.0.6
|
||||
* `decorder`: from 0.2.1 to 0.2.2
|
||||
* `honnef.co/go/tools`: from 0.3.1 to 0.3.2
|
||||
* `golang.org/x/tools`: bump to HEAD
|
||||
* `errcheck`: from 1.6.0 to 1.6.1
|
||||
* `errname`: from 0.1.6 to 0.1.7
|
||||
* `exhaustive`: from 0.7.11 to 0.8.1
|
||||
* `gci`: fix issues and re-enable autofix
|
||||
* `gci`: from 0.3.4 to 0.4.2
|
||||
* `go-exhaustruct`: from 2.1.0 to 2.2.0
|
||||
* `go-ruleguard`: from 0.3.19 to 0.3.21
|
||||
* `gocognit`: from 1.0.5 to 1.0.6
|
||||
* `gocyclo`: from 0.5.1 to 0.6.0
|
||||
* `golang.org/x/tools`: bump to HEAD
|
||||
* `gosec`: allow `global` config
|
||||
* `gosec`: from 2.11.0 to 2.12.0
|
||||
* `nonamedreturns`: from 1.0.1 to 1.0.4
|
||||
* `paralleltest`: from 1.0.3 to 1.0.6
|
||||
* `staticcheck`: fix generics
|
||||
* `staticcheck`: from 0.3.1 to 0.3.2
|
||||
* `tenv`: from 1.5.0 to 1.6.0
|
||||
* `testpackage`: from 1.0.1 to 1.1.0
|
||||
* `thelper`: from 0.6.2 to 0.6.3
|
||||
* `wrapcheck`: from 2.6.1 to 2.6.2
|
||||
3. documentation:
|
||||
* add thanks page
|
||||
* add a clear explanation about the `staticcheck` integration.
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"go/token"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
@ -186,6 +187,7 @@ func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) {
|
||||
}
|
||||
|
||||
normalizeConfig(conf)
|
||||
ignoreRules(conf)
|
||||
|
||||
reviveDebugf("revive configuration: %#v", conf)
|
||||
|
||||
@ -254,7 +256,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{},
|
||||
// &rule.VarDeclarationsRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (var-declaration)
|
||||
&rule.PackageCommentsRule{},
|
||||
&rule.DotImportsRule{},
|
||||
&rule.BlankImportsRule{},
|
||||
@ -262,15 +264,15 @@ var defaultRules = []lint.Rule{
|
||||
&rule.VarNamingRule{},
|
||||
&rule.IndentErrorFlowRule{},
|
||||
&rule.RangeRule{},
|
||||
&rule.ErrorfRule{},
|
||||
// &rule.ErrorfRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (errorf
|
||||
&rule.ErrorNamingRule{},
|
||||
&rule.ErrorStringsRule{},
|
||||
&rule.ReceiverNamingRule{},
|
||||
&rule.IncrementDecrementRule{},
|
||||
&rule.ErrorReturnRule{},
|
||||
&rule.UnexportedReturnRule{},
|
||||
&rule.TimeNamingRule{},
|
||||
&rule.ContextKeysType{},
|
||||
// &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.ContextAsArgumentRule{},
|
||||
}
|
||||
|
||||
@ -291,7 +293,7 @@ var allRules = append([]lint.Rule{
|
||||
&rule.FlagParamRule{},
|
||||
&rule.UnnecessaryStmtRule{},
|
||||
&rule.StructTagRule{},
|
||||
&rule.ModifiesValRecRule{},
|
||||
// &rule.ModifiesValRecRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (modifies-value-receiver)
|
||||
&rule.ConstantLogicalExprRule{},
|
||||
&rule.BoolLiteralRule{},
|
||||
&rule.RedefinesBuiltinIDRule{},
|
||||
@ -299,7 +301,7 @@ var allRules = append([]lint.Rule{
|
||||
&rule.FunctionResultsLimitRule{},
|
||||
&rule.MaxPublicStructsRule{},
|
||||
&rule.RangeValInClosureRule{},
|
||||
&rule.RangeValAddress{},
|
||||
// &rule.RangeValAddress{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (range-val-address)
|
||||
&rule.WaitGroupByValueRule{},
|
||||
&rule.AtomicRule{},
|
||||
&rule.EmptyLinesRule{},
|
||||
@ -309,9 +311,9 @@ var allRules = append([]lint.Rule{
|
||||
&rule.ImportShadowingRule{},
|
||||
&rule.BareReturnRule{},
|
||||
&rule.UnusedReceiverRule{},
|
||||
&rule.UnhandledErrorRule{},
|
||||
// &rule.UnhandledErrorRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (unhandled-error)
|
||||
&rule.CognitiveComplexityRule{},
|
||||
&rule.StringOfIntRule{},
|
||||
// &rule.StringOfIntRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (string-of-int)
|
||||
&rule.StringFormatRule{},
|
||||
&rule.EarlyReturnRule{},
|
||||
&rule.UnconditionalRecursionRule{},
|
||||
@ -322,7 +324,7 @@ var allRules = append([]lint.Rule{
|
||||
&rule.NestedStructs{},
|
||||
&rule.IfReturnRule{},
|
||||
&rule.UselessBreak{},
|
||||
&rule.TimeEqualRule{},
|
||||
// &rule.TimeEqualRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (time-equal)
|
||||
&rule.BannedCharsRule{},
|
||||
&rule.OptimizeOperandsOrderRule{},
|
||||
}, defaultRules...)
|
||||
@ -388,3 +390,33 @@ 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, ","))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user