Skip to content

Commit a8d6d80

Browse files
gandarezSeigeC
authored andcommitted
wsl: fix force-err-cuddling flag (golangci#3407)
1 parent 7a4f11e commit a8d6d80

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.golangci.reference.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,15 +1953,15 @@ linters-settings:
19531953

19541954
# Causes an error when an If statement that checks an error variable doesn't
19551955
# cuddle with the assignment of that variable.
1956-
enforce-err-cuddling: false
1956+
force-err-cuddling: false
19571957

1958-
# When enforce-err-cuddling is enabled this is a list of names
1958+
# When force-err-cuddling is enabled this is a list of names
19591959
# used for error variables to check for in the conditional.
19601960
error-variable-names: [ "err" ]
19611961

19621962
# Causes an error if a short declaration (:=) cuddles with anything other than
19631963
# another short declaration.
1964-
# This logic overrides enforce-err-cuddling among others.
1964+
# This logic overrides force-err-cuddling among others.
19651965
force-short-decl-cuddling: false
19661966

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

pkg/config/linters_settings.go

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 0 deletions
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)