File tree 11 files changed +54
-76
lines changed
github.com/ultraware/whitespace 11 files changed +54
-76
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,8 @@ linters-settings:
209
209
max-blank-identifiers : 2
210
210
211
211
whitespace :
212
- multi-if : false
212
+ multi-if : false # Enforces newlines (or comments) after every multi-line if statement
213
+ multi-func : false # Enforces newlines (or comments) after every multi-line function signature
213
214
214
215
linters :
215
216
enable :
Original file line number Diff line number Diff line change @@ -799,7 +799,8 @@ linters-settings:
799
799
max-blank-identifiers: 2
800
800
801
801
whitespace:
802
- multi-if: false
802
+ multi-if: false # Enforces newlines (or comments) after every multi-line if statement
803
+ multi-func: false # Enforces newlines (or comments) after every multi-line function signature
803
804
804
805
linters:
805
806
enable:
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ require (
36
36
github.com/stretchr/testify v1.4.0
37
37
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e
38
38
github.com/ultraware/funlen v0.0.2
39
- github.com/ultraware/whitespace v0.0.3
39
+ github.com/ultraware/whitespace v0.0.4
40
40
github.com/uudashr/gocognit v0.0.0-20190926065955-1655d0de0517
41
41
github.com/valyala/quicktemplate v1.2.0
42
42
golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678
Original file line number Diff line number Diff line change @@ -232,8 +232,8 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr
232
232
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 /go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0 =
233
233
github.com/ultraware/funlen v0.0.2 h1:Av96YVBwwNSe4MLR7iI/BIa3VyI7/djnto/pK3Uxbdo =
234
234
github.com/ultraware/funlen v0.0.2 /go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA =
235
- github.com/ultraware/whitespace v0.0.3 h1:S5BCRRB5sttNy0bSOhbpw+0mb+cHiCmWfrvxpEzuUk0 =
236
- github.com/ultraware/whitespace v0.0.3 /go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA =
235
+ github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg =
236
+ github.com/ultraware/whitespace v0.0.4 /go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA =
237
237
github.com/uudashr/gocognit v0.0.0-20190926065955-1655d0de0517 h1:ChMKTho2hWKpks/nD/FL2KqM1wuVt62oJeiE8+eFpGs =
238
238
github.com/uudashr/gocognit v0.0.0-20190926065955-1655d0de0517 /go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM =
239
239
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw =
Original file line number Diff line number Diff line change @@ -175,7 +175,8 @@ type LintersSettings struct {
175
175
Statements int
176
176
}
177
177
Whitespace struct {
178
- MultiIf bool `mapstructure:"multi-if"`
178
+ MultiIf bool `mapstructure:"multi-if"`
179
+ MultiFunc bool `mapstructure:"multi-func"`
179
180
}
180
181
181
182
Lll LllSettings
Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ func NewWhitespace() *goanalysis.Linter {
28
28
[]* analysis.Analyzer {analyzer },
29
29
nil ,
30
30
).WithContextSetter (func (lintCtx * linter.Context ) {
31
- settings := whitespace.Settings {MultiIf : lintCtx .Cfg .LintersSettings .Whitespace .MultiIf }
31
+ cfg := lintCtx .Cfg .LintersSettings .Whitespace
32
+ settings := whitespace.Settings {MultiIf : cfg .MultiIf , MultiFunc : cfg .MultiFunc }
32
33
33
34
analyzer .Run = func (pass * analysis.Pass ) (interface {}, error ) {
34
35
var issues []whitespace.Message
Original file line number Diff line number Diff line change 1
1
//args: -Ewhitespace
2
2
//config: linters-settings.whitespace.multi-if=true
3
+ //config: linters-settings.whitespace.multi-func=true
3
4
package p
4
5
5
6
import "fmt"
@@ -47,9 +48,14 @@ func twoLeadingNewlines() {
47
48
fmt .Println ("Hello world" )
48
49
}
49
50
51
+ func multiFuncFunc (a int ,
52
+ b int ) {
53
+ fmt .Println ("Hello world" )
54
+ }
55
+
50
56
func multiIfFunc () {
51
57
if 1 == 1 &&
52
58
2 == 2 {
53
- fmt .Println (` Hello multi-line world` )
59
+ fmt .Println (" Hello multi-line world" )
54
60
}
55
61
}
Original file line number Diff line number Diff line change 1
1
//args: -Ewhitespace
2
2
//config: linters-settings.whitespace.multi-if=true
3
+ //config: linters-settings.whitespace.multi-func=true
3
4
package p
4
5
5
6
import "fmt"
@@ -43,10 +44,16 @@ func twoLeadingNewlines() {
43
44
fmt .Println ("Hello world" )
44
45
}
45
46
47
+ func multiFuncFunc (a int ,
48
+ b int ) {
49
+
50
+ fmt .Println ("Hello world" )
51
+ }
52
+
46
53
func multiIfFunc () {
47
54
if 1 == 1 &&
48
55
2 == 2 {
49
56
50
- fmt .Println (` Hello multi-line world` )
57
+ fmt .Println (" Hello multi-line world" )
51
58
}
52
59
}
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ github.com/stretchr/testify/require
168
168
github.com/timakin/bodyclose/passes/bodyclose
169
169
# github.com/ultraware/funlen v0.0.2
170
170
github.com/ultraware/funlen
171
- # github.com/ultraware/whitespace v0.0.3
171
+ # github.com/ultraware/whitespace v0.0.4
172
172
github.com/ultraware/whitespace
173
173
# github.com/uudashr/gocognit v0.0.0-20190926065955-1655d0de0517
174
174
github.com/uudashr/gocognit
You can’t perform that action at this time.
0 commit comments