From 242ebf152f51feb5fea6ed9f9e2964a050619da5 Mon Sep 17 00:00:00 2001 From: Oleg Butuzov Date: Tue, 18 Jan 2022 15:53:30 +0200 Subject: [PATCH 1/2] varnamelen: explicit default values --- .golangci.example.yml | 10 +++++----- pkg/config/linters_settings.go | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index df2af8e2525e..600084187f58 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -1057,19 +1057,19 @@ linters-settings: varnamelen: # The longest distance, in source lines, that is being considered a "small scope." (defaults to 5) # Variables used in at most this many lines will be ignored. - max-distance: 5 + max-distance: 6 # The minimum length of a variable's name that is considered "long." (defaults to 3) # Variable names that are at least this long will be ignored. - min-name-length: 3 + min-name-length: 2 # Check method receiver names. (defaults to false) check-receiver: false # Check named return values. (defaults to false) check-return: false - # Ignore "ok" variables that hold the bool return value of a type assertion. (defaults to false) + # Ignore "ok" variables that hold the bool return value of a type assertion. (defaults to true) ignore-type-assert-ok: false - # Ignore "ok" variables that hold the bool return value of a map index. (defaults to false) + # Ignore "ok" variables that hold the bool return value of a map index. (defaults to true) ignore-map-index-ok: false - # Ignore "ok" variables that hold the bool return value of a channel receive. (defaults to false) + # Ignore "ok" variables that hold the bool return value of a channel receive. (defaults to true) ignore-chan-recv-ok: false # Optional list of variable names that should be ignored completely. (defaults to empty list) ignore-names: diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index e7f07db50aa4..1df16729eb00 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -81,6 +81,13 @@ var defaultLintersSettings = LintersSettings{ Unparam: UnparamSettings{ Algo: "cha", }, + Varnamelen: VarnamelenSettings{ + MaxDistance: 5, + MinNameLength: 3, + IgnoreTypeAssertOk: true, + IgnoreMapIndexOk: true, + IgnoreChanRecvOk: true, + }, WSL: WSLSettings{ StrictAppend: true, AllowAssignAndCallCuddle: true, From 4556d594f62e913456861650fcf2cc7bb0ed6083 Mon Sep 17 00:00:00 2001 From: Oleg Butuzov Date: Wed, 19 Jan 2022 10:23:03 +0200 Subject: [PATCH 2/2] dev: revert `Ignore...Ok` settings back to false --- .golangci.example.yml | 6 +++--- pkg/config/linters_settings.go | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.golangci.example.yml b/.golangci.example.yml index 600084187f58..cb8045d635f2 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -1065,11 +1065,11 @@ linters-settings: check-receiver: false # Check named return values. (defaults to false) check-return: false - # Ignore "ok" variables that hold the bool return value of a type assertion. (defaults to true) + # Ignore "ok" variables that hold the bool return value of a type assertion. (defaults to false) ignore-type-assert-ok: false - # Ignore "ok" variables that hold the bool return value of a map index. (defaults to true) + # Ignore "ok" variables that hold the bool return value of a map index. (defaults to false) ignore-map-index-ok: false - # Ignore "ok" variables that hold the bool return value of a channel receive. (defaults to true) + # Ignore "ok" variables that hold the bool return value of a channel receive. (defaults to false) ignore-chan-recv-ok: false # Optional list of variable names that should be ignored completely. (defaults to empty list) ignore-names: diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 1df16729eb00..338e6b14d3fa 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -82,11 +82,8 @@ var defaultLintersSettings = LintersSettings{ Algo: "cha", }, Varnamelen: VarnamelenSettings{ - MaxDistance: 5, - MinNameLength: 3, - IgnoreTypeAssertOk: true, - IgnoreMapIndexOk: true, - IgnoreChanRecvOk: true, + MaxDistance: 5, + MinNameLength: 3, }, WSL: WSLSettings{ StrictAppend: true,