Skip to content

Commit 0d6e043

Browse files
committed
gocritic enabled-checks and disabled-checks can be combined
The documentation currently indicates that enable-checks and disabled-checks can't be combined for gocritic. That is however not accurate: as per InferEnabledChecks in the gocritic wrapper, * if enable-all is set, all available checks are added to the set of enabled checks * otherwise, unless disable-all is set, the default checks are added to the set of enabled checks * then the checks corresponding to each enabled tag are added * then all enabled checks are added (with a warning if a check is enabled multiple times) * then the checks corresponding to each disabled tag are removed * finally, all disabled checks are removed (with a warning if a check wasn't enabled) Using both enabled-checks and disabled-checks is useful when keeping the default set of checks as reference. This adjusts the documentation to match the implementation. Signed-off-by: Stephen Kitt <[email protected]>
1 parent 3ff4d3b commit 0d6e043

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.golangci.next.reference.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,8 @@ linters:
717717
# Disable all checks.
718718
# Default: false
719719
disable-all: true
720-
# Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.
721-
# By default, list of stable checks is used (https://go-critic.com/overview#checks-overview):
720+
# Which checks should be enabled in addition to default checks (or at all, if disable-all is true).
721+
# The default checks are gocritic's stable checks (https://go-critic.com/overview#checks-overview):
722722
# appendAssign, argOrder, assignOp, badCall, badCond, captLocal, caseOrder, codegenComment, commentFormatting,
723723
# defaultCaseOrder, deprecatedComment, dupArg, dupBranchBody, dupCase, dupSubExpr, elseif, exitAfterDefer,
724724
# flagDeref, flagName, ifElseChain, mapKey, newDeref, offBy1, regexpMust, singleCaseSwitch, sloppyLen,
@@ -1047,7 +1047,7 @@ linters:
10471047
# Enable all checks.
10481048
# Default: false
10491049
enable-all: true
1050-
# Which checks should be disabled; can't be combined with 'enabled-checks'.
1050+
# Which checks should be disabled.
10511051
# Default: []
10521052
disabled-checks:
10531053
- appendAssign

.golangci.reference.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,8 @@ linters:
704704
# Disable all checks.
705705
# Default: false
706706
disable-all: true
707-
# Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.
708-
# By default, list of stable checks is used (https://go-critic.com/overview#checks-overview):
707+
# Which checks should be enabled in addition to default checks (or at all, if disable-all is true).
708+
# The default checks are gocritic's stable checks (https://go-critic.com/overview#checks-overview):
709709
# appendAssign, argOrder, assignOp, badCall, badCond, captLocal, caseOrder, codegenComment, commentFormatting,
710710
# defaultCaseOrder, deprecatedComment, dupArg, dupBranchBody, dupCase, dupSubExpr, elseif, exitAfterDefer,
711711
# flagDeref, flagName, ifElseChain, mapKey, newDeref, offBy1, regexpMust, singleCaseSwitch, sloppyLen,
@@ -1034,7 +1034,7 @@ linters:
10341034
# Enable all checks.
10351035
# Default: false
10361036
enable-all: true
1037-
# Which checks should be disabled; can't be combined with 'enabled-checks'.
1037+
# Which checks should be disabled.
10381038
# Default: []
10391039
disabled-checks:
10401040
- appendAssign

0 commit comments

Comments
 (0)