Skip to content

Commit b18f3a9

Browse files
committed
revive: ignore slow rules
1 parent dc02378 commit b18f3a9

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed

CHANGELOG.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ There is the most valuable changes log:
1616
* `asasalint`: https://github.com/alingse/asasalint
1717
* `nosnakecase`: https://github.com/sivchari/nosnakecase
1818
2. updated linters:
19+
* `decorder`: from 0.2.1 to 0.2.2
20+
* `errcheck`: from 1.6.0 to 1.6.1
1921
* `errname`: from 0.1.6 to 0.1.7
22+
* `exhaustive`: from 0.7.11 to 0.8.1
23+
* `gci`: fix issues and re-enable autofix
2024
* `gci`: from 0.3.4 to 0.4.2
21-
* `nonamedreturns`: from 1.0.1 to 1.0.4
22-
* `gocyclo`: from 0.5.1 to 0.6.0
2325
* `go-exhaustruct`: from 2.1.0 to 2.2.0
24-
* `errcheck`: from 1.6.0 to 1.6.1
25-
* `thelper`: from 0.6.2 to 0.6.3
26-
* `paralleltest`: from 1.0.3 to 1.0.6
27-
* `testpackage`: from 1.0.1 to 1.1.0
28-
* `exhaustive`: from 0.7.11 to 0.8.1
2926
* `go-ruleguard`: from 0.3.19 to 0.3.21
30-
* `gosec`: from 2.11.0 to 2.12.0
31-
* `tenv`: from 1.5.0 to 1.6.0
32-
* `wrapcheck`: from 2.6.1 to 2.6.2
3327
* `gocognit`: from 1.0.5 to 1.0.6
34-
* `decorder`: from 0.2.1 to 0.2.2
35-
* `honnef.co/go/tools`: from 0.3.1 to 0.3.2
28+
* `gocyclo`: from 0.5.1 to 0.6.0
3629
* `golang.org/x/tools`: bump to HEAD
37-
* `gci`: fix issues and re-enable autofix
3830
* `gosec`: allow `global` config
31+
* `gosec`: from 2.11.0 to 2.12.0
32+
* `nonamedreturns`: from 1.0.1 to 1.0.4
33+
* `paralleltest`: from 1.0.3 to 1.0.6
3934
* `staticcheck`: fix generics
35+
* `staticcheck`: from 0.3.1 to 0.3.2
36+
* `tenv`: from 1.5.0 to 1.6.0
37+
* `testpackage`: from 1.0.1 to 1.1.0
38+
* `thelper`: from 0.6.2 to 0.6.3
39+
* `wrapcheck`: from 2.6.1 to 2.6.2
4040
3. documentation:
4141
* add thanks page
4242
* add a clear explanation about the `staticcheck` integration.

pkg/golinters/revive.go

+31-10
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) {
186186
}
187187

188188
normalizeConfig(conf)
189+
ignoreRules(conf)
189190

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

@@ -254,23 +255,23 @@ func safeTomlSlice(r []interface{}) []interface{} {
254255
// This element is not exported by revive, so we need copy the code.
255256
// Extracted from https://github.com/mgechev/revive/blob/v1.1.4/config/config.go#L15
256257
var defaultRules = []lint.Rule{
257-
&rule.VarDeclarationsRule{},
258+
// &rule.VarDeclarationsRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (var-declaration)
258259
&rule.PackageCommentsRule{},
259260
&rule.DotImportsRule{},
260261
&rule.BlankImportsRule{},
261262
&rule.ExportedRule{},
262263
&rule.VarNamingRule{},
263264
&rule.IndentErrorFlowRule{},
264265
&rule.RangeRule{},
265-
&rule.ErrorfRule{},
266+
// &rule.ErrorfRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (errorf
266267
&rule.ErrorNamingRule{},
267268
&rule.ErrorStringsRule{},
268269
&rule.ReceiverNamingRule{},
269270
&rule.IncrementDecrementRule{},
270271
&rule.ErrorReturnRule{},
271-
&rule.UnexportedReturnRule{},
272-
&rule.TimeNamingRule{},
273-
&rule.ContextKeysType{},
272+
// &rule.UnexportedReturnRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (unexported-return)
273+
// &rule.TimeNamingRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (time-naming)
274+
// &rule.ContextKeysType{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (context-keys-type)
274275
&rule.ContextAsArgumentRule{},
275276
}
276277

@@ -291,15 +292,15 @@ var allRules = append([]lint.Rule{
291292
&rule.FlagParamRule{},
292293
&rule.UnnecessaryStmtRule{},
293294
&rule.StructTagRule{},
294-
&rule.ModifiesValRecRule{},
295+
// &rule.ModifiesValRecRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (modifies-value-receiver)
295296
&rule.ConstantLogicalExprRule{},
296297
&rule.BoolLiteralRule{},
297298
&rule.RedefinesBuiltinIDRule{},
298299
&rule.ImportsBlacklistRule{},
299300
&rule.FunctionResultsLimitRule{},
300301
&rule.MaxPublicStructsRule{},
301302
&rule.RangeValInClosureRule{},
302-
&rule.RangeValAddress{},
303+
// &rule.RangeValAddress{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (range-val-address)
303304
&rule.WaitGroupByValueRule{},
304305
&rule.AtomicRule{},
305306
&rule.EmptyLinesRule{},
@@ -309,9 +310,9 @@ var allRules = append([]lint.Rule{
309310
&rule.ImportShadowingRule{},
310311
&rule.BareReturnRule{},
311312
&rule.UnusedReceiverRule{},
312-
&rule.UnhandledErrorRule{},
313+
// &rule.UnhandledErrorRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (unhandled-error)
313314
&rule.CognitiveComplexityRule{},
314-
&rule.StringOfIntRule{},
315+
// &rule.StringOfIntRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (string-of-int)
315316
&rule.StringFormatRule{},
316317
&rule.EarlyReturnRule{},
317318
&rule.UnconditionalRecursionRule{},
@@ -322,7 +323,7 @@ var allRules = append([]lint.Rule{
322323
&rule.NestedStructs{},
323324
&rule.IfReturnRule{},
324325
&rule.UselessBreak{},
325-
&rule.TimeEqualRule{},
326+
// &rule.TimeEqualRule{}, // TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997 (time-equal)
326327
&rule.BannedCharsRule{},
327328
&rule.OptimizeOperandsOrderRule{},
328329
}, defaultRules...)
@@ -388,3 +389,23 @@ func defaultConfig() *lint.Config {
388389
}
389390
return &defaultConfig
390391
}
392+
393+
// TODO(ldez) https://github.com/golangci/golangci-lint/issues/2997
394+
func ignoreRules(conf *lint.Config) {
395+
f := []string{
396+
"context-keys-type",
397+
"errorf",
398+
"modifies-value-receiver",
399+
"range-val-address",
400+
"string-of-int",
401+
"time-equal",
402+
"time-naming",
403+
"unexported-return",
404+
"unhandled-error",
405+
"var-declaration",
406+
}
407+
408+
for _, s := range f {
409+
delete(conf.Rules, s)
410+
}
411+
}

0 commit comments

Comments
 (0)