From 7ca0a46ff3c62578b0d53ece0214e3319d1d5fe0 Mon Sep 17 00:00:00 2001 From: serosset Date: Sat, 23 Oct 2021 16:35:33 +0000 Subject: [PATCH 1/8] Add documentation for go-critic and ruleguard settings --- .golangci.example.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 836947d5631a..a23d6b0f1b9a 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -236,8 +236,26 @@ linters-settings: # whether to check test functions (default true) skipTestFuncs: true ruleguard: + # Enable debug for the specified named ruleguard rule group. + # When debug is enabled, ruleguard provides an explanation on why a rule + # is rejected (e.g. which Where() condition failed). + debug: 'm.Match(`!($x != $y)`)' + # Deprecated, use failOn param + # If set to true, identical to failOn='all', otherwise failOn='' + failOnError: false + # Determines the behavior when an error occurs while parsing ruleguard files. + # If flag is not set, log error and skip rule files that contain an error. + # If flag is set, the value must be a comma-separated list of error conditions. + # * 'import': rule refers to a package that cannot be loaded. + # * 'dsl': gorule file does not comply with the ruleguard DSL. + failOn: dsl + # Comma-separated list of gorule file paths. + # Glob patterns such as 'rules-*.go' may be specified # path to a gorules file for the ruleguard checker - rules: '' + rules: 'rules-*.go,myrule1.go,myrules/rule1.go' + tooManyResultsChecker: + # maximum number of results (default 5) + maxResults: 10 truncateCmp: # whether to skip int/uint/uintptr types (default true) skipArchDependent: true From 9b9a7396876cfa578823c82dc28dcc9e207ce4d9 Mon Sep 17 00:00:00 2001 From: serosset Date: Sat, 23 Oct 2021 16:49:22 +0000 Subject: [PATCH 2/8] Add documentation for go-critic and ruleguard settings --- .golangci.example.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index a23d6b0f1b9a..c5170553bf90 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -240,21 +240,22 @@ linters-settings: # When debug is enabled, ruleguard provides an explanation on why a rule # is rejected (e.g. which Where() condition failed). debug: 'm.Match(`!($x != $y)`)' - # Deprecated, use failOn param + # Deprecated, use 'failOn' param. # If set to true, identical to failOn='all', otherwise failOn='' failOnError: false # Determines the behavior when an error occurs while parsing ruleguard files. - # If flag is not set, log error and skip rule files that contain an error. - # If flag is set, the value must be a comma-separated list of error conditions. - # * 'import': rule refers to a package that cannot be loaded. - # * 'dsl': gorule file does not comply with the ruleguard DSL. + # If flag is not set, log error and skip rule files that contain an error. + # If flag is set, the value must be a comma-separated list of error conditions. + # * 'all': fail on all errors. + # * 'import': rule refers to a package that cannot be loaded. + # * 'dsl': gorule file does not comply with the ruleguard DSL. failOn: dsl # Comma-separated list of gorule file paths. # Glob patterns such as 'rules-*.go' may be specified # path to a gorules file for the ruleguard checker rules: 'rules-*.go,myrule1.go,myrules/rule1.go' tooManyResultsChecker: - # maximum number of results (default 5) + # maximum number of results (default 5) maxResults: 10 truncateCmp: # whether to skip int/uint/uintptr types (default true) From 45d331b5e0296d4382fa3eb35081d326324757a8 Mon Sep 17 00:00:00 2001 From: serosset Date: Sat, 23 Oct 2021 16:51:26 +0000 Subject: [PATCH 3/8] Add documentation for go-critic and ruleguard settings --- .golangci.example.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index c5170553bf90..bde1179275ea 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -246,9 +246,9 @@ linters-settings: # Determines the behavior when an error occurs while parsing ruleguard files. # If flag is not set, log error and skip rule files that contain an error. # If flag is set, the value must be a comma-separated list of error conditions. - # * 'all': fail on all errors. - # * 'import': rule refers to a package that cannot be loaded. - # * 'dsl': gorule file does not comply with the ruleguard DSL. + # - 'all': fail on all errors. + # - 'import': ruleguard rule imports a package that cannot be found. + # - 'dsl': gorule file does not comply with the ruleguard DSL. failOn: dsl # Comma-separated list of gorule file paths. # Glob patterns such as 'rules-*.go' may be specified From 725a7ba7748155aa0935073089095d61df141f08 Mon Sep 17 00:00:00 2001 From: serosset Date: Sat, 23 Oct 2021 17:39:40 +0000 Subject: [PATCH 4/8] Add documentation for go-critic and ruleguard settings --- .golangci.example.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index bde1179275ea..7737a4623a38 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -236,10 +236,18 @@ linters-settings: # whether to check test functions (default true) skipTestFuncs: true ruleguard: - # Enable debug for the specified named ruleguard rule group. - # When debug is enabled, ruleguard provides an explanation on why a rule - # is rejected (e.g. which Where() condition failed). - debug: 'm.Match(`!($x != $y)`)' + # Enable debug to identify which 'Where' condition was rejected. + # The value of the parameter is the name of a function in a ruleguard file. + # + # When a rule is evaluated: + # If: + # The Match() clause is accepted; and + # One of the conditions in the Where() clause is rejected, + # Then: + # ruleguard prints the specific Where() condition that was rejected. + # + # The flag is passed to the ruleguard 'debug-group' argument. + debug: 'emptyDecl' # Deprecated, use 'failOn' param. # If set to true, identical to failOn='all', otherwise failOn='' failOnError: false From 95eb5ca27aabeba8d167c09eb9f5ab450880def3 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset Date: Tue, 26 Oct 2021 12:30:01 -0700 Subject: [PATCH 5/8] Add missing period --- .golangci.example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 7737a4623a38..589bd742ed10 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -259,7 +259,7 @@ linters-settings: # - 'dsl': gorule file does not comply with the ruleguard DSL. failOn: dsl # Comma-separated list of gorule file paths. - # Glob patterns such as 'rules-*.go' may be specified + # Glob patterns such as 'rules-*.go' may be specified. # path to a gorules file for the ruleguard checker rules: 'rules-*.go,myrule1.go,myrules/rule1.go' tooManyResultsChecker: From f4d044f05eceaa21f6da3618a99686491c137886 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset Date: Tue, 26 Oct 2021 12:31:47 -0700 Subject: [PATCH 6/8] Remove redundant description. --- .golangci.example.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 589bd742ed10..6c51767e28be 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -260,7 +260,6 @@ linters-settings: failOn: dsl # Comma-separated list of gorule file paths. # Glob patterns such as 'rules-*.go' may be specified. - # path to a gorules file for the ruleguard checker rules: 'rules-*.go,myrule1.go,myrules/rule1.go' tooManyResultsChecker: # maximum number of results (default 5) From b94690a1b46ee4821fd8fd83a3e2371251805936 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset Date: Mon, 1 Nov 2021 18:58:59 -0700 Subject: [PATCH 7/8] Improve go-critic config example --- .golangci.example.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 6c51767e28be..471625c7d327 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -258,7 +258,9 @@ linters-settings: # - 'import': ruleguard rule imports a package that cannot be found. # - 'dsl': gorule file does not comply with the ruleguard DSL. failOn: dsl - # Comma-separated list of gorule file paths. + # Comma-separated list of file paths containing ruleguard rules. + # If a path is relative, it is relative to the directory where the golangci-lint command is executed. + # The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file. # Glob patterns such as 'rules-*.go' may be specified. rules: 'rules-*.go,myrule1.go,myrules/rule1.go' tooManyResultsChecker: From b0d9b1ca19515dbb1a534118a7c361ba1b232d6a Mon Sep 17 00:00:00 2001 From: Sebastien Rosset Date: Mon, 1 Nov 2021 18:59:08 -0700 Subject: [PATCH 8/8] Improve go-critic config example --- .golangci.example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 471625c7d327..0b2a9ee94d67 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -262,7 +262,7 @@ linters-settings: # If a path is relative, it is relative to the directory where the golangci-lint command is executed. # The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file. # Glob patterns such as 'rules-*.go' may be specified. - rules: 'rules-*.go,myrule1.go,myrules/rule1.go' + rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go' tooManyResultsChecker: # maximum number of results (default 5) maxResults: 10