Skip to content

Commit 87cdb2d

Browse files
Add settings examples for gocritic (#1562)
1 parent 92d94ff commit 87cdb2d

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

.golangci.example.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,44 @@ linters-settings:
149149
disabled-tags:
150150
- experimental
151151

152-
settings: # settings passed to gocritic
152+
# Settings passed to gocritic.
153+
# The settings key is the name of a supported gocritic checker.
154+
# The list of supported checkers can be find in https://go-critic.github.io/overview.
155+
settings:
153156
captLocal: # must be valid enabled check name
154-
paramsOnly: true
157+
# whether to restrict checker to params only (default true)
158+
paramsOnly: true
159+
elseif:
160+
# whether to skip balanced if-else pairs (default true)
161+
skipBalanced: true
162+
hugeParam:
163+
# size in bytes that makes the warning trigger (default 80)
164+
sizeThreshold: 80
165+
nestingReduce:
166+
# min number of statements inside a branch to trigger a warning (default 5)
167+
bodyWidth: 5
168+
rangeExprCopy:
169+
# size in bytes that makes the warning trigger (default 512)
170+
sizeThreshold: 512
171+
# whether to check test functions (default true)
172+
skipTestFuncs: true
155173
rangeValCopy:
174+
# size in bytes that makes the warning trigger (default 128)
156175
sizeThreshold: 32
176+
# whether to check test functions (default true)
177+
skipTestFuncs: true
178+
ruleguard:
179+
# path to a gorules file for the ruleguard checker
180+
rules: ''
181+
truncateCmp:
182+
# whether to skip int/uint/uintptr types (default true)
183+
skipArchDependent: true
184+
underef:
185+
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
186+
skipRecvDeref: true
187+
unnamedResult:
188+
# whether to check exported functions
189+
checkExported: true
157190
gocyclo:
158191
# minimal code complexity to report, 30 by default (but we recommend 10-20)
159192
min-complexity: 10

0 commit comments

Comments
 (0)