Skip to content

Commit b6a852f

Browse files
committed
gocritic: support of enable-all and disable-all options
1 parent bc169eb commit b6a852f

File tree

5 files changed

+657
-295
lines changed

5 files changed

+657
-295
lines changed

.golangci.reference.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,22 +525,32 @@ linters-settings:
525525
ignore-strings: 'foo.+'
526526

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

544+
# Enable all checks.
545+
# Default: false
546+
enable-all: true
538547
# Which checks should be disabled; can't be combined with 'enabled-checks'.
539548
# Default: []
540549
disabled-checks:
541550
- regexpMust
542551

543-
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
552+
# Enable multiple checks by tags in additional to default checks.
553+
# Run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic` to see all tags and checks.
544554
# See https://github.com/go-critic/go-critic#usage -> section "Tags".
545555
# Default: []
546556
enabled-tags:

pkg/config/linters_settings.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,9 @@ type GoConstSettings struct {
459459

460460
type GoCriticSettings struct {
461461
Go string `mapstructure:"-"`
462+
DisableAll bool `mapstructure:"disable-all"`
462463
EnabledChecks []string `mapstructure:"enabled-checks"`
464+
EnableAll bool `mapstructure:"enable-all"`
463465
DisabledChecks []string `mapstructure:"disabled-checks"`
464466
EnabledTags []string `mapstructure:"enabled-tags"`
465467
DisabledTags []string `mapstructure:"disabled-tags"`

0 commit comments

Comments
 (0)