Skip to content

Commit 28dd63d

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 2691aac commit 28dd63d

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
@@ -727,8 +727,8 @@ linters-settings:
727727
# Disable all checks.
728728
# Default: false
729729
disable-all: true
730-
# Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.
731-
# By default, list of stable checks is used (https://go-critic.com/overview#checks-overview):
730+
# Which checks should be enabled in addition to default checks (or at all, if disable-all is true).
731+
# The default checks are gocritic's stable checks (https://go-critic.com/overview#checks-overview):
732732
# appendAssign, argOrder, assignOp, badCall, badCond, captLocal, caseOrder, codegenComment, commentFormatting,
733733
# defaultCaseOrder, deprecatedComment, dupArg, dupBranchBody, dupCase, dupSubExpr, elseif, exitAfterDefer,
734734
# flagDeref, flagName, ifElseChain, mapKey, newDeref, offBy1, regexpMust, singleCaseSwitch, sloppyLen,
@@ -1057,7 +1057,7 @@ linters-settings:
10571057
# Enable all checks.
10581058
# Default: false
10591059
enable-all: true
1060-
# Which checks should be disabled; can't be combined with 'enabled-checks'.
1060+
# Which checks should be disabled.
10611061
# Default: []
10621062
disabled-checks:
10631063
- appendAssign

.golangci.reference.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ linters-settings:
727727
# Disable all checks.
728728
# Default: false
729729
disable-all: true
730-
# Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.
731-
# By default, list of stable checks is used (https://go-critic.com/overview#checks-overview):
730+
# Which checks should be enabled in addition to default checks (or at all, if disable-all is true).
731+
# The default checks are gocritic's stable checks (https://go-critic.com/overview#checks-overview):
732732
# appendAssign, argOrder, assignOp, badCall, badCond, captLocal, caseOrder, codegenComment, commentFormatting,
733733
# defaultCaseOrder, deprecatedComment, dupArg, dupBranchBody, dupCase, dupSubExpr, elseif, exitAfterDefer,
734734
# flagDeref, flagName, ifElseChain, mapKey, newDeref, offBy1, regexpMust, singleCaseSwitch, sloppyLen,
@@ -1057,7 +1057,7 @@ linters-settings:
10571057
# Enable all checks.
10581058
# Default: false
10591059
enable-all: true
1060-
# Which checks should be disabled; can't be combined with 'enabled-checks'.
1060+
# Which checks should be disabled.
10611061
# Default: []
10621062
disabled-checks:
10631063
- appendAssign

0 commit comments

Comments
 (0)