gocritic: update default checks list

Update gocritic default checks list, add the current gocritic stable checks list
This commit is contained in:
David López 2018-12-28 09:35:55 +01:00 committed by Isaev Denis
parent 658f4addbd
commit 0192cb3955
3 changed files with 24 additions and 7 deletions

View File

@ -151,9 +151,10 @@ linters-settings:
for-loops: false # Report preallocation suggestions on for loops, false by default
gocritic:
# which checks should be enabled; can't be combined with 'disabled-checks';
# default are: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref
# ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef
# unlambda unslice rangeValCopy defaultCaseOrder];
# default are: [appendAssign appendCombine assignOp builtinShadow captLocal caseOrder defaultCaseOrder
# dupArg dupBranchBody dupCase elseif flagDeref ifElseChain importShadow indexAlloc paramTypeCombine
# rangeExprCopy rangeValCopy regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar typeUnparen
# underef unlambda unslice dupSubExpr hugeParam];
# all checks list: https://github.com/go-critic/checkers
enabled-checks:
- rangeValCopy

View File

@ -493,6 +493,7 @@ Global Flags:
--cpu-profile-path string Path to CPU profile output file
--mem-profile-path string Path to memory profile output file
-v, --verbose verbose output
--version Print version
```
@ -667,9 +668,10 @@ linters-settings:
for-loops: false # Report preallocation suggestions on for loops, false by default
gocritic:
# which checks should be enabled; can't be combined with 'disabled-checks';
# default are: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref
# ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef
# unlambda unslice rangeValCopy defaultCaseOrder];
# default are: [appendAssign appendCombine assignOp builtinShadow captLocal caseOrder defaultCaseOrder
# dupArg dupBranchBody dupCase elseif flagDeref ifElseChain importShadow indexAlloc paramTypeCombine
# rangeExprCopy rangeValCopy regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar typeUnparen
# underef unlambda unslice dupSubExpr hugeParam];
# all checks list: https://github.com/go-critic/checkers
enabled-checks:
- rangeValCopy

View File

@ -257,24 +257,38 @@ func (s GocriticSettings) IsCheckEnabled(name string) bool {
return s.inferredEnabledChecks[strings.ToLower(name)]
}
// Its a good idea to keep this list in sync with the gocritic stable checks list in:
// https://github.com/go-critic/go-critic/blob/master/checkers/checkers_test.go#L63
var defaultGocriticEnabledChecks = []string{
"appendAssign",
"appendCombine",
"assignOp",
"builtinShadow",
"captLocal",
"caseOrder",
"defaultCaseOrder",
"dupArg",
"dupBranchBody",
"dupCase",
"elseif",
"flagDeref",
"ifElseChain",
"importShadow",
"indexAlloc",
"paramTypeCombine",
"rangeExprCopy",
"rangeValCopy",
"regexpMust",
"singleCaseSwitch",
"sloppyLen",
"switchTrue",
"typeSwitchVar",
"typeUnparen",
"underef",
"unlambda",
"unslice",
"defaultCaseOrder",
"dupSubExpr",
"hugeParam",
}
var defaultLintersSettings = LintersSettings{