Skip to content

Commit 71ed760

Browse files
committed
wsl: fix force-err-cuddling flag
1 parent 67d57f4 commit 71ed760

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.golangci.reference.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1928,15 +1928,15 @@ linters-settings:
19281928

19291929
# Causes an error when an If statement that checks an error variable doesn't
19301930
# cuddle with the assignment of that variable.
1931-
enforce-err-cuddling: false
1931+
force-err-cuddling: false
19321932

1933-
# When enforce-err-cuddling is enabled this is a list of names
1933+
# When force-err-cuddling is enabled this is a list of names
19341934
# used for error variables to check for in the conditional.
19351935
error-variable-names: [ "err" ]
19361936

19371937
# Causes an error if a short declaration (:=) cuddles with anything other than
19381938
# another short declaration.
1939-
# This logic overrides enforce-err-cuddling among others.
1939+
# This logic overrides force-err-cuddling among others.
19401940
force-short-decl-cuddling: false
19411941

19421942
# The custom section can be used to define linter plugins to be loaded at runtime.

pkg/config/linters_settings.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ type WSLSettings struct {
713713
AllowCuddleDeclaration bool `mapstructure:"allow-cuddle-declarations"`
714714
AllowCuddleWithCalls []string `mapstructure:"allow-cuddle-with-calls"`
715715
AllowCuddleWithRHS []string `mapstructure:"allow-cuddle-with-rhs"`
716-
ForceCuddleErrCheckAndAssign bool `mapstructure:"enforce-err-cuddling"`
716+
ForceCuddleErrCheckAndAssign bool `mapstructure:"force-err-cuddling"`
717717
ErrorVariableNames []string `mapstructure:"error-variable-names"`
718718
ForceExclusiveShortDeclarations bool `mapstructure:"force-short-decl-cuddling"`
719719
}

pkg/golinters/wsl.go

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ func NewWSL(settings *config.WSLSettings) *goanalysis.Linter {
3232
conf.AllowCuddleDeclaration = settings.AllowCuddleDeclaration
3333
conf.AllowCuddleWithCalls = settings.AllowCuddleWithCalls
3434
conf.AllowCuddleWithRHS = settings.AllowCuddleWithRHS
35+
conf.ForceCuddleErrCheckAndAssign = settings.ForceCuddleErrCheckAndAssign
36+
conf.ErrorVariableNames = settings.ErrorVariableNames
37+
conf.ForceExclusiveShortDeclarations = settings.ForceExclusiveShortDeclarations
3538
}
3639

3740
analyzer := &analysis.Analyzer{

0 commit comments

Comments
 (0)