Bump wsl to v3.2.0 (#1750)

This commit is contained in:
Simon Sawert 2021-02-20 15:16:10 +01:00 committed by GitHub
parent 92d38e5237
commit b7aac3b1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 2 deletions

View File

@ -411,6 +411,8 @@ linters-settings:
# Allow calls and assignments to be cuddled as long as the lines have any
# matching variables, fields or types. Default is true.
allow-assign-and-call: true
# Allow assignments to be cuddled with anything. Default is false.
allow-assign-and-anything: false
# Allow multiline assignments to be cuddled. Default is true.
allow-multiline-assign: true
# Allow declarations (var) to be cuddled.

2
go.mod
View File

@ -11,7 +11,7 @@ require (
github.com/ashanbrown/forbidigo v1.1.0
github.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a
github.com/bkielbasa/cyclop v1.2.0
github.com/bombsimon/wsl/v3 v3.1.0
github.com/bombsimon/wsl/v3 v3.2.0
github.com/charithe/durationcheck v0.0.4
github.com/daixiang0/gci v0.2.8
github.com/denis-tingajkin/go-header v0.4.2

2
go.sum generated
View File

@ -45,6 +45,8 @@ github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7
github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI=
github.com/bombsimon/wsl/v3 v3.1.0 h1:E5SRssoBgtVFPcYWUOFJEcgaySgdtTNYzsSKDOY7ss8=
github.com/bombsimon/wsl/v3 v3.1.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc=
github.com/bombsimon/wsl/v3 v3.2.0 h1:x3QUbwW7tPGcCNridvqmhSRthZMTALnkg5/1J+vaUas=
github.com/bombsimon/wsl/v3 v3.2.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/charithe/durationcheck v0.0.4 h1:lD3ud3KJ2DaoL80EZ768cSBv3DS8Xr7nNgN+kgW1tts=
github.com/charithe/durationcheck v0.0.4/go.mod h1:0oCYOIgY8Om3hZxPedxKn0mzy0rneKTWJhRm+r6Gl20=

View File

@ -350,6 +350,7 @@ type GocognitSettings struct {
type WSLSettings struct {
StrictAppend bool `mapstructure:"strict-append"`
AllowAssignAndCallCuddle bool `mapstructure:"allow-assign-and-call"`
AllowAssignAndAnythingCuddle bool `mapstructure:"allow-assign-and-anything"`
AllowMultiLineAssignCuddle bool `mapstructure:"allow-multiline-assign"`
AllowCuddleDeclaration bool `mapstructure:"allow-cuddle-declarations"`
AllowTrailingComment bool `mapstructure:"allow-trailing-comment"`
@ -491,6 +492,7 @@ var defaultLintersSettings = LintersSettings{
WSL: WSLSettings{
StrictAppend: true,
AllowAssignAndCallCuddle: true,
AllowAssignAndAnythingCuddle: false,
AllowMultiLineAssignCuddle: true,
AllowCuddleDeclaration: false,
AllowTrailingComment: false,

View File

@ -39,6 +39,7 @@ func NewWSL() *goanalysis.Linter {
processorCfg = wsl.Configuration{
StrictAppend: linterCfg.StrictAppend,
AllowAssignAndCallCuddle: linterCfg.AllowAssignAndCallCuddle,
AllowAssignAndAnythingCuddle: linterCfg.AllowAssignAndAnythingCuddle,
AllowMultiLineAssignCuddle: linterCfg.AllowMultiLineAssignCuddle,
AllowCuddleDeclaration: linterCfg.AllowCuddleDeclaration,
AllowTrailingComment: linterCfg.AllowTrailingComment,

View File

@ -66,7 +66,14 @@ func main() {
"multiple",
)
if err != nil { // ERROR "if statements should only be cuddled with assignments used in the if statement itself"
panic(notErr)
panic("not from the line above")
}
// This is OK since we use a variable from the line above, even if we don't
// check it with the if.
xx := notErr
if err != nil {
panic(xx)
}
}