Skip to content

Commit 0192cb3

Browse files
lopezatorjirfag
authored andcommitted
gocritic: update default checks list
Update gocritic default checks list, add the current gocritic stable checks list
1 parent 658f4ad commit 0192cb3

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

.golangci.example.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ linters-settings:
151151
for-loops: false # Report preallocation suggestions on for loops, false by default
152152
gocritic:
153153
# which checks should be enabled; can't be combined with 'disabled-checks';
154-
# default are: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref
155-
# ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef
156-
# unlambda unslice rangeValCopy defaultCaseOrder];
154+
# default are: [appendAssign appendCombine assignOp builtinShadow captLocal caseOrder defaultCaseOrder
155+
# dupArg dupBranchBody dupCase elseif flagDeref ifElseChain importShadow indexAlloc paramTypeCombine
156+
# rangeExprCopy rangeValCopy regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar typeUnparen
157+
# underef unlambda unslice dupSubExpr hugeParam];
157158
# all checks list: https://github.com/go-critic/checkers
158159
enabled-checks:
159160
- rangeValCopy

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ Global Flags:
493493
--cpu-profile-path string Path to CPU profile output file
494494
--mem-profile-path string Path to memory profile output file
495495
-v, --verbose verbose output
496+
--version Print version
496497
497498
```
498499
@@ -667,9 +668,10 @@ linters-settings:
667668
for-loops: false # Report preallocation suggestions on for loops, false by default
668669
gocritic:
669670
# which checks should be enabled; can't be combined with 'disabled-checks';
670-
# default are: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref
671-
# ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef
672-
# unlambda unslice rangeValCopy defaultCaseOrder];
671+
# default are: [appendAssign appendCombine assignOp builtinShadow captLocal caseOrder defaultCaseOrder
672+
# dupArg dupBranchBody dupCase elseif flagDeref ifElseChain importShadow indexAlloc paramTypeCombine
673+
# rangeExprCopy rangeValCopy regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar typeUnparen
674+
# underef unlambda unslice dupSubExpr hugeParam];
673675
# all checks list: https://github.com/go-critic/checkers
674676
enabled-checks:
675677
- rangeValCopy

pkg/config/config.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,24 +257,38 @@ func (s GocriticSettings) IsCheckEnabled(name string) bool {
257257
return s.inferredEnabledChecks[strings.ToLower(name)]
258258
}
259259

260+
// Its a good idea to keep this list in sync with the gocritic stable checks list in:
261+
// https://github.com/go-critic/go-critic/blob/master/checkers/checkers_test.go#L63
260262
var defaultGocriticEnabledChecks = []string{
261263
"appendAssign",
264+
"appendCombine",
262265
"assignOp",
266+
"builtinShadow",
267+
"captLocal",
263268
"caseOrder",
269+
"defaultCaseOrder",
264270
"dupArg",
265271
"dupBranchBody",
266272
"dupCase",
273+
"elseif",
267274
"flagDeref",
268275
"ifElseChain",
276+
"importShadow",
277+
"indexAlloc",
278+
"paramTypeCombine",
279+
"rangeExprCopy",
280+
"rangeValCopy",
269281
"regexpMust",
270282
"singleCaseSwitch",
271283
"sloppyLen",
272284
"switchTrue",
273285
"typeSwitchVar",
286+
"typeUnparen",
274287
"underef",
275288
"unlambda",
276289
"unslice",
277-
"defaultCaseOrder",
290+
"dupSubExpr",
291+
"hugeParam",
278292
}
279293

280294
var defaultLintersSettings = LintersSettings{

0 commit comments

Comments
 (0)