Skip to content

Commit 4a21479

Browse files
committed
Update wsl to v3.0.0
* Support to force cuddle with error checking * Support to separate leading comments with empty lines
1 parent b851f17 commit 4a21479

25 files changed

+961
-263
lines changed

.golangci.example.yml

+4
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ linters-settings:
237237
allow-trailing-comment: false
238238
# Force newlines in end of case at this limit (0 = never).
239239
force-case-trailing-whitespace: 0
240+
# Force cuddling of err checks with err var assignment
241+
force-err-cuddling: false
242+
# Allow leading comments to be separated with empty liens
243+
allow-separated-leading-comment: false
240244

241245
# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
242246
# for more info.

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,10 @@ linters-settings:
847847
allow-trailing-comment: false
848848
# Force newlines in end of case at this limit (0 = never).
849849
force-case-trailing-whitespace: 0
850+
# Force cuddling of err checks with err var assignment
851+
force-err-cuddling: false
852+
# Allow leading comments to be separated with empty liens
853+
allow-separated-leading-comment: false
850854
851855
# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
852856
# for more info.

pkg/config/config.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ type WSLSettings struct {
268268
AllowMultiLineAssignCuddle bool `mapstructure:"allow-multiline-assign"`
269269
AllowCuddleDeclaration bool `mapstructure:"allow-cuddle-declarations"`
270270
AllowTrailingComment bool `mapstructure:"allow-trailing-comment"`
271-
CaseForceTrailingWhitespaceLimit int `mapstructure:"force-case-trailing-whitespace:"`
271+
AllowSeparatedLeadingComment bool `mapstructure:"allow-separated-leading-comment"`
272+
ForceCuddleErrCheckAndAssign bool `mapstructure:"force-err-cuddling"`
273+
ForceCaseTrailingWhitespaceLimit int `mapstructure:"force-case-trailing-whitespace"`
272274
}
273275

274276
//nolint:gomnd
@@ -306,7 +308,9 @@ var defaultLintersSettings = LintersSettings{
306308
AllowMultiLineAssignCuddle: true,
307309
AllowCuddleDeclaration: false,
308310
AllowTrailingComment: false,
309-
CaseForceTrailingWhitespaceLimit: 0,
311+
AllowSeparatedLeadingComment: false,
312+
ForceCuddleErrCheckAndAssign: false,
313+
ForceCaseTrailingWhitespaceLimit: 0,
310314
},
311315
}
312316

pkg/golinters/wsl.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package golinters
33
import (
44
"sync"
55

6-
"github.com/bombsimon/wsl/v2"
6+
"github.com/bombsimon/wsl/v3"
77
"golang.org/x/tools/go/analysis"
88

99
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
@@ -42,9 +42,12 @@ func NewWSL() *goanalysis.Linter {
4242
AllowMultiLineAssignCuddle: linterCfg.AllowMultiLineAssignCuddle,
4343
AllowCuddleDeclaration: linterCfg.AllowCuddleDeclaration,
4444
AllowTrailingComment: linterCfg.AllowTrailingComment,
45-
CaseForceTrailingWhitespaceLimit: linterCfg.CaseForceTrailingWhitespaceLimit,
45+
AllowSeparatedLeadingComment: linterCfg.AllowSeparatedLeadingComment,
46+
ForceCuddleErrCheckAndAssign: linterCfg.ForceCuddleErrCheckAndAssign,
47+
ForceCaseTrailingWhitespaceLimit: linterCfg.ForceCaseTrailingWhitespaceLimit,
4648
AllowCuddleWithCalls: []string{"Lock", "RLock"},
4749
AllowCuddleWithRHS: []string{"Unlock", "RUnlock"},
50+
ErrorVariableNames: []string{"err"},
4851
}
4952
)
5053

vendor/github.com/bombsimon/wsl/v2/go.mod

-12
This file was deleted.

vendor/github.com/bombsimon/wsl/v2/go.sum

-30
This file was deleted.

vendor/github.com/bombsimon/wsl/v2/README.md renamed to vendor/github.com/bombsimon/wsl/v3/README.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/bombsimon/wsl/v3/go.mod

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/bombsimon/wsl/v3/go.sum

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)