Skip to content

Commit 77d4115

Browse files
docs: add documentation for go-critic and ruleguard settings (#2304)
1 parent 2c01ea7 commit 77d4115

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.golangci.example.yml

+30-2
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,36 @@ linters-settings:
239239
# whether to check test functions (default true)
240240
skipTestFuncs: true
241241
ruleguard:
242-
# path to a gorules file for the ruleguard checker
243-
rules: ''
242+
# Enable debug to identify which 'Where' condition was rejected.
243+
# The value of the parameter is the name of a function in a ruleguard file.
244+
#
245+
# When a rule is evaluated:
246+
# If:
247+
# The Match() clause is accepted; and
248+
# One of the conditions in the Where() clause is rejected,
249+
# Then:
250+
# ruleguard prints the specific Where() condition that was rejected.
251+
#
252+
# The flag is passed to the ruleguard 'debug-group' argument.
253+
debug: 'emptyDecl'
254+
# Deprecated, use 'failOn' param.
255+
# If set to true, identical to failOn='all', otherwise failOn=''
256+
failOnError: false
257+
# Determines the behavior when an error occurs while parsing ruleguard files.
258+
# If flag is not set, log error and skip rule files that contain an error.
259+
# If flag is set, the value must be a comma-separated list of error conditions.
260+
# - 'all': fail on all errors.
261+
# - 'import': ruleguard rule imports a package that cannot be found.
262+
# - 'dsl': gorule file does not comply with the ruleguard DSL.
263+
failOn: dsl
264+
# Comma-separated list of file paths containing ruleguard rules.
265+
# If a path is relative, it is relative to the directory where the golangci-lint command is executed.
266+
# The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file.
267+
# Glob patterns such as 'rules-*.go' may be specified.
268+
rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go'
269+
tooManyResultsChecker:
270+
# maximum number of results (default 5)
271+
maxResults: 10
244272
truncateCmp:
245273
# whether to skip int/uint/uintptr types (default true)
246274
skipArchDependent: true

0 commit comments

Comments
 (0)