From c7809749bf71ca8564bd95970b667b76851bf7d1 Mon Sep 17 00:00:00 2001 From: "Sebastien Rosset (serosset)" Date: Thu, 17 Dec 2020 08:26:15 -0800 Subject: [PATCH 1/5] Add setttings examples for gocritic --- .golangci.example.yml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index c1a2e8311f97..d2985efbc687 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -151,9 +151,39 @@ linters-settings: settings: # settings passed to gocritic captLocal: # must be valid enabled check name - paramsOnly: true + # whether to restrict checker to params only (default true) + paramsOnly: true + elseif: + # whether to skip balanced if-else pairs (default true) + skipBalanced: true + hugeParam: + # size in bytes that makes the warning trigger (default 80) + sizeThreshold: 80 + nestingReduce: + # min number of statements inside a branch to trigger a warning (default 5) + bodyWidth: 5 + rangeExprCopy: + # size in bytes that makes the warning trigger (default 512) + sizeThreshold: 512 + # whether to check test functions (default true) + skipTestFuncs: true rangeValCopy: + # size in bytes that makes the warning trigger (default 128) sizeThreshold: 32 + # whether to check test functions (default true) + skipTestFuncs: true + ruleguard: + # path to a gorules file + rules: '' + truncateCmp: + # whether to skip int/uint/uintptr types (default true) + skipArchDependent: true + underef: + # whether to skip (*x).method() calls where x is a pointer receiver (default true) + skipRecvDeref: true + unnamedResult: + # whether to check exported functions + checkExported: true gocyclo: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 10 From 6eb5b6cb9a54972d972018e9a7dcc0aaa455e765 Mon Sep 17 00:00:00 2001 From: "Sebastien Rosset (serosset)" Date: Thu, 17 Dec 2020 08:27:22 -0800 Subject: [PATCH 2/5] Add setttings examples for gocritic --- .golangci.example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index d2985efbc687..0cc87095af58 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -173,7 +173,7 @@ linters-settings: # whether to check test functions (default true) skipTestFuncs: true ruleguard: - # path to a gorules file + # path to a gorules file for the ruleguard checker rules: '' truncateCmp: # whether to skip int/uint/uintptr types (default true) From 306f0f5af37379c688d479e79103cce485f9eade Mon Sep 17 00:00:00 2001 From: "Sebastien Rosset (serosset)" Date: Thu, 17 Dec 2020 08:30:14 -0800 Subject: [PATCH 3/5] Add setttings examples for gocritic --- .golangci.example.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 0cc87095af58..6160d1d7b235 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -149,7 +149,9 @@ linters-settings: disabled-tags: - experimental - settings: # settings passed to gocritic + # Settings passed to gocritic. + # The list of supported settings can be obtained using `gocritic check -h` + settings: captLocal: # must be valid enabled check name # whether to restrict checker to params only (default true) paramsOnly: true From 3177177e19b6de9c854ef5a2672bca21f126ad87 Mon Sep 17 00:00:00 2001 From: "Sebastien Rosset (serosset)" Date: Thu, 17 Dec 2020 09:57:29 -0800 Subject: [PATCH 4/5] Add setttings examples for gocritic --- .golangci.example.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 6160d1d7b235..6ea70234db30 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -150,7 +150,9 @@ linters-settings: - experimental # Settings passed to gocritic. - # The list of supported settings can be obtained using `gocritic check -h` + # The settings key is the name of a supported gocritic checker. + # The list of supported checkers can be obtained using `gocritic doc`. + # The list of supported checker settings can be obtained using `gocritic check -h` settings: captLocal: # must be valid enabled check name # whether to restrict checker to params only (default true) From 8539bbe76dcb764d2574398936d5aa6bedcb1152 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset Date: Thu, 17 Dec 2020 23:06:13 -0800 Subject: [PATCH 5/5] Update .golangci.example.yml Co-authored-by: Ludovic Fernandez --- .golangci.example.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 6ea70234db30..c994edc30349 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -151,8 +151,7 @@ linters-settings: # Settings passed to gocritic. # The settings key is the name of a supported gocritic checker. - # The list of supported checkers can be obtained using `gocritic doc`. - # The list of supported checker settings can be obtained using `gocritic check -h` + # The list of supported checkers can be find in https://go-critic.github.io/overview. settings: captLocal: # must be valid enabled check name # whether to restrict checker to params only (default true)