Skip to content

Commit c65868c

Browse files
Antonboomldez
andauthored
gocritic: support of enable-all and disable-all options (#4335)
Co-authored-by: Ludovic Fernandez <[email protected]>
1 parent b07bd18 commit c65868c

12 files changed

+794
-399
lines changed

.golangci.reference.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -529,22 +529,32 @@ linters-settings:
529529
ignore-strings: 'foo.+'
530530

531531
gocritic:
532-
# Which checks should be enabled; can't be combined with 'disabled-checks'.
533-
# See https://go-critic.github.io/overview#checks-overview.
534-
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`.
535-
# By default, list of stable checks is used.
532+
# Disable all checks.
533+
# Default: false
534+
disable-all: true
535+
# Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.
536+
# By default, list of stable checks is used (https://go-critic.github.io/overview#checks-overview):
537+
# appendAssign, argOrder, assignOp, badCall, badCond, captLocal, caseOrder, codegenComment, commentFormatting,
538+
# defaultCaseOrder, deprecatedComment, dupArg, dupBranchBody, dupCase, dupSubExpr, elseif, exitAfterDefer,
539+
# flagDeref, flagName, ifElseChain, mapKey, newDeref, offBy1, regexpMust, singleCaseSwitch, sloppyLen,
540+
# sloppyTypeAssert, switchTrue, typeSwitchVar, underef, unlambda, unslice, valSwap, wrapperFunc
541+
# To see which checks are enabled run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic`.
536542
enabled-checks:
537543
- nestingReduce
538544
- unnamedResult
539545
- ruleguard
540546
- truncateCmp
541547

548+
# Enable all checks.
549+
# Default: false
550+
enable-all: true
542551
# Which checks should be disabled; can't be combined with 'enabled-checks'.
543552
# Default: []
544553
disabled-checks:
545554
- regexpMust
546555

547-
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
556+
# Enable multiple checks by tags in addition to default checks.
557+
# Run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic` to see all tags and checks.
548558
# See https://github.com/go-critic/go-critic#usage -> section "Tags".
549559
# Default: []
550560
enabled-tags:

pkg/config/linters_settings.go

+2
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ type GoConstSettings struct {
460460

461461
type GoCriticSettings struct {
462462
Go string `mapstructure:"-"`
463+
DisableAll bool `mapstructure:"disable-all"`
463464
EnabledChecks []string `mapstructure:"enabled-checks"`
465+
EnableAll bool `mapstructure:"enable-all"`
464466
DisabledChecks []string `mapstructure:"disabled-checks"`
465467
EnabledTags []string `mapstructure:"enabled-tags"`
466468
DisabledTags []string `mapstructure:"disabled-tags"`

0 commit comments

Comments
 (0)