File tree 4 files changed +14
-0
lines changed
4 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -3885,6 +3885,12 @@ linters-settings:
3885
3885
# Defaults: [ "Unlock", "RUnlock" ]
3886
3886
allow-cuddle-with-rhs : [ "Foo", "Bar" ]
3887
3887
3888
+ # Allow cuddling with any block as long as the variable is used somewhere in
3889
+ # the block.
3890
+ # https://github.com/bombsimon/wsl/blob/HEAD/doc/configuration.md#allow-cuddle-used-in-block
3891
+ # Default: false
3892
+ allow-cuddle-used-in-block : true
3893
+
3888
3894
# Causes an error when an If statement that checks an error variable doesn't
3889
3895
# cuddle with the assignment of that variable.
3890
3896
# https://github.com/bombsimon/wsl/blob/HEAD/doc/configuration.md#force-err-cuddling
Original file line number Diff line number Diff line change 3782
3782
"type" : " string"
3783
3783
}
3784
3784
},
3785
+ "allow-cuddle-used-in-block" : {
3786
+ "description" : " Allow cuddling with any block as long as the variable is used somewhere in the block" ,
3787
+ "type" : " boolean" ,
3788
+ "default" : false
3789
+ },
3785
3790
"allow-multiline-assign" : {
3786
3791
"description" : " Allow multiline assignments to be cuddled." ,
3787
3792
"type" : " boolean" ,
Original file line number Diff line number Diff line change @@ -207,6 +207,7 @@ var defaultLintersSettings = LintersSettings{
207
207
AllowCuddleDeclaration : false ,
208
208
AllowCuddleWithCalls : []string {"Lock" , "RLock" },
209
209
AllowCuddleWithRHS : []string {"Unlock" , "RUnlock" },
210
+ AllowCuddleUsedInBlock : false ,
210
211
ForceCuddleErrCheckAndAssign : false ,
211
212
ErrorVariableNames : []string {"err" },
212
213
ForceExclusiveShortDeclarations : false ,
@@ -1082,6 +1083,7 @@ type WSLSettings struct {
1082
1083
AllowCuddleDeclaration bool `mapstructure:"allow-cuddle-declarations"`
1083
1084
AllowCuddleWithCalls []string `mapstructure:"allow-cuddle-with-calls"`
1084
1085
AllowCuddleWithRHS []string `mapstructure:"allow-cuddle-with-rhs"`
1086
+ AllowCuddleUsedInBlock bool `mapstructure:"allow-cuddle-used-in-block"`
1085
1087
ForceCuddleErrCheckAndAssign bool `mapstructure:"force-err-cuddling"`
1086
1088
ErrorVariableNames []string `mapstructure:"error-variable-names"`
1087
1089
ForceExclusiveShortDeclarations bool `mapstructure:"force-short-decl-cuddling"`
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ func New(settings *config.WSLSettings) *goanalysis.Linter {
23
23
AllowCuddleWithCalls : settings .AllowCuddleWithCalls ,
24
24
AllowCuddleWithRHS : settings .AllowCuddleWithRHS ,
25
25
ForceCuddleErrCheckAndAssign : settings .ForceCuddleErrCheckAndAssign ,
26
+ AllowCuddleUsedInBlock : settings .AllowCuddleUsedInBlock ,
26
27
ErrorVariableNames : settings .ErrorVariableNames ,
27
28
ForceExclusiveShortDeclarations : settings .ForceExclusiveShortDeclarations ,
28
29
IncludeGenerated : true , // force to true because golangci-lint already have a way to filter generated files.
You can’t perform that action at this time.
0 commit comments