Skip to content

Commit 14ebae2

Browse files
bombsimontpounds
authored andcommitted
Bump wsl to v1.2.7
1 parent 1248f09 commit 14ebae2

File tree

11 files changed

+304
-666
lines changed

11 files changed

+304
-666
lines changed

.golangci.example.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,12 @@ linters-settings:
223223
allow-assign-and-call: true
224224
# Allow multiline assignments to be cuddled. Default is true.
225225
allow-multiline-assign: true
226-
# Allow case blocks to end with a whitespace.
227-
allow-case-traling-whitespace: true
228226
# Allow declarations (var) to be cuddled.
229227
allow-cuddle-declarations: false
228+
# Allow trailing comments in ending of blocks
229+
allow-trailing-comment: false
230+
# Force newlines in end of case at this limit (0 = never).
231+
force-case-trailing-whitespace: 0
230232

231233
linters:
232234
enable:

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -824,10 +824,12 @@ linters-settings:
824824
allow-assign-and-call: true
825825
# Allow multiline assignments to be cuddled. Default is true.
826826
allow-multiline-assign: true
827-
# Allow case blocks to end with a whitespace.
828-
allow-case-traling-whitespace: true
829827
# Allow declarations (var) to be cuddled.
830828
allow-cuddle-declarations: false
829+
# Allow trailing comments in ending of blocks
830+
allow-trailing-comment: false
831+
# Force newlines in end of case at this limit (0 = never).
832+
force-case-trailing-whitespace: 0
831833
832834
linters:
833835
enable:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.12
44

55
require (
66
github.com/OpenPeeDeeP/depguard v1.0.1
7-
github.com/bombsimon/wsl v1.2.5
7+
github.com/bombsimon/wsl v1.2.7
88
github.com/fatih/color v1.7.0
99
github.com/go-critic/go-critic v0.3.5-0.20190904082202-d79a9f0c64db
1010
github.com/go-lintpack/lintpack v0.5.2

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
1111
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
1212
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
1313
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
14-
github.com/bombsimon/wsl v1.2.5 h1:9gTOkIwVtoDZywvX802SDHokeX4kW1cKnV8ZTVAPkRs=
15-
github.com/bombsimon/wsl v1.2.5/go.mod h1:43lEF/i0kpXbLCeDXL9LMT8c92HyBywXb0AsgMHYngM=
14+
github.com/bombsimon/wsl v1.2.7 h1:hckBZYt27e6Ff6yqV/SurMUe48BmXzJk/KVjxDyWtUE=
15+
github.com/bombsimon/wsl v1.2.7/go.mod h1:43lEF/i0kpXbLCeDXL9LMT8c92HyBywXb0AsgMHYngM=
1616
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
1717
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
1818
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=

pkg/config/config.go

+12-10
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,12 @@ type GocognitSettings struct {
255255
}
256256

257257
type WSLSettings struct {
258-
StrictAppend bool `mapstructure:"strict-append"`
259-
AllowAssignAndCallCuddle bool `mapstructure:"allow-assign-and-call"`
260-
AllowMultiLineAssignCuddle bool `mapstructure:"allow-multiline-assign"`
261-
AllowCaseTrailingWhitespace bool `mapstructure:"allow-case-trailing-whitespace"`
262-
AllowCuddleDeclaration bool `mapstructure:"allow-cuddle-declarations"`
258+
StrictAppend bool `mapstructure:"strict-append"`
259+
AllowAssignAndCallCuddle bool `mapstructure:"allow-assign-and-call"`
260+
AllowMultiLineAssignCuddle bool `mapstructure:"allow-multiline-assign"`
261+
AllowCuddleDeclaration bool `mapstructure:"allow-cuddle-declarations"`
262+
AllowTrailingComment bool `mapstructure:"allow-trailing-comment"`
263+
CaseForceTrailingWhitespaceLimit int `mapstructure:"force-case-trailing-whitespace:"`
263264
}
264265

265266
var defaultLintersSettings = LintersSettings{
@@ -291,11 +292,12 @@ var defaultLintersSettings = LintersSettings{
291292
MinComplexity: 30,
292293
},
293294
WSL: WSLSettings{
294-
StrictAppend: true,
295-
AllowAssignAndCallCuddle: true,
296-
AllowMultiLineAssignCuddle: true,
297-
AllowCaseTrailingWhitespace: true,
298-
AllowCuddleDeclaration: false,
295+
StrictAppend: true,
296+
AllowAssignAndCallCuddle: true,
297+
AllowMultiLineAssignCuddle: true,
298+
AllowCuddleDeclaration: false,
299+
AllowTrailingComment: false,
300+
CaseForceTrailingWhitespaceLimit: 0,
299301
},
300302
}
301303

pkg/golinters/wsl.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ func NewWSL() *goanalysis.Linter {
3737
files = []string{}
3838
linterCfg = lintCtx.Cfg.LintersSettings.WSL
3939
processorCfg = wsl.Configuration{
40-
StrictAppend: linterCfg.StrictAppend,
41-
AllowAssignAndCallCuddle: linterCfg.AllowAssignAndCallCuddle,
42-
AllowMultiLineAssignCuddle: linterCfg.AllowMultiLineAssignCuddle,
43-
AllowCaseTrailingWhitespace: linterCfg.AllowCaseTrailingWhitespace,
44-
AllowCuddleDeclaration: linterCfg.AllowCuddleDeclaration,
45-
AllowCuddleWithCalls: []string{"Lock", "RLock"},
46-
AllowCuddleWithRHS: []string{"Unlock", "RUnlock"},
40+
StrictAppend: linterCfg.StrictAppend,
41+
AllowAssignAndCallCuddle: linterCfg.AllowAssignAndCallCuddle,
42+
AllowMultiLineAssignCuddle: linterCfg.AllowMultiLineAssignCuddle,
43+
AllowCuddleDeclaration: linterCfg.AllowCuddleDeclaration,
44+
AllowTrailingComment: linterCfg.AllowTrailingComment,
45+
CaseForceTrailingWhitespaceLimit: linterCfg.CaseForceTrailingWhitespaceLimit,
46+
AllowCuddleWithCalls: []string{"Lock", "RLock"},
47+
AllowCuddleWithRHS: []string{"Unlock", "RUnlock"},
4748
}
4849
)
4950

test/testdata/wsl.go

+39-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func allowTrailing(i int) {
159159

160160
case 2:
161161
fmt.Println("two")
162-
162+
// Comments OK too!
163163
case 3:
164164
fmt.Println("three")
165165
}
@@ -172,3 +172,41 @@ func ExampleSomeOutput() {
172172
// Output:
173173
// Hello, world
174174
}
175+
176+
func IncDecStmt() {
177+
counter := 0
178+
for range make([]int, 5) {
179+
counter++
180+
}
181+
182+
type t struct {
183+
counter int
184+
}
185+
186+
x := t{5}
187+
188+
x.counter--
189+
if x.counter > 0 {
190+
fmt.Println("not yet 0")
191+
}
192+
}
193+
194+
func AnonymousBlock() {
195+
func(a, b int) { // ERROR "block should not start with a whitespace"
196+
197+
fmt.Println(a + b)
198+
}(1, 1)
199+
}
200+
201+
func MultilineComment() {
202+
if true {
203+
/*
204+
Ok to start block with
205+
a
206+
long
207+
multiline
208+
cmoment
209+
*/
210+
fmt.Println("true")
211+
}
212+
}

vendor/github.com/bombsimon/wsl/.travis.yml

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

0 commit comments

Comments
 (0)