forked from mgechev/revive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
empty-lines.go
170 lines (126 loc) 路 2.81 KB
/
empty-lines.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Test of empty-lines.
package fixtures
import "time"
func f1(x *int) bool { // MATCH /extra empty line at the start of a block/
return x > 2
}
func f2(x *int) bool { // MATCH /extra empty line at the end of a block/
return x > 2
}
func f3(x *int) bool { // MATCH /extra empty line at the start of a block/
return x > 2 // MATCH:17 /extra empty line at the end of a block/
}
func f4(x *int) bool {
// This is fine.
return x > 2
}
func f5(x *int) bool { // MATCH /extra empty line at the start of a block/
// This is _not_ fine.
return x > 2
}
func f6(x *int) bool {
return x > 2
// This is fine.
}
func f7(x *int) bool { // MATCH /extra empty line at the end of a block/
return x > 2
// This is _not_ fine.
}
func f8(*int) bool {
if x > 2 { // MATCH /extra empty line at the start of a block/
return true
}
return false
}
func f9(*int) bool {
if x > 2 { // MATCH /extra empty line at the end of a block/
return true
}
return false
}
func f10(*int) bool { // MATCH /extra empty line at the start of a block/
if x > 2 {
return true
}
return false
}
func f11(x *int) bool {
if x > 2 {
return true
}
}
func f12(x *int) bool { // MATCH /extra empty line at the end of a block/
if x > 2 {
return true
}
}
func f13(x *int) bool {
switch {
case x == 2:
return false
}
}
func f14(x *int) bool { // MATCH /extra empty line at the end of a block/
switch {
case x == 2:
return false
}
}
func f15(x *int) bool {
switch { // MATCH /extra empty line at the end of a block/
case x == 2:
return false
}
}
func f16(x *int) bool {
return Query(
qm("x = ?", x),
).Execute()
}
func f17(x *int) bool { // MATCH /extra empty line at the end of a block/
return Query(
qm("x = ?", x),
).Execute()
}
func f18(x *int) bool {
if true {
if true {
return true
}
// TODO: should we handle the error here?
}
return false
}
func w() {
select {
case <-time.After(dur):
// TODO: Handle Ctrl-C is pressed in `mysql` client.
// return 1 when SLEEP() is KILLed
}
return 0, false, nil
}
func x() {
if tagArray[2] == "req" {
bit := len(u.reqFields)
u.reqFields = append(u.reqFields, name)
reqMask = uint64(1) << uint(bit)
// TODO: if we have more than 64 required fields, we end up
// not verifying that all required fields are present.
// Fix this, perhaps using a count of required fields?
}
if err == nil { // No need to refresh if the stream is over or failed.
// Consider any buffered body data (read from the conn but not
// consumed by the client) when computing flow control for this
// stream.
v := int(cs.inflow.available()) + cs.bufPipe.Len()
if v < transportDefaultStreamFlow-transportDefaultStreamMinRefresh {
streamAdd = int32(transportDefaultStreamFlow - v)
cs.inflow.add(streamAdd)
}
}
}
func ShouldNotWarn() {
// comment
println()
// comment
}