File tree Expand file tree Collapse file tree 8 files changed +249
-132
lines changed
golinters/funlen/testdata Expand file tree Collapse file tree 8 files changed +249
-132
lines changed Original file line number Diff line number Diff line change @@ -544,8 +544,8 @@ linters:
544544 # Default: 40
545545 statements : -1
546546 # Ignore comments when counting lines.
547- # Default false
548- ignore-comments : true
547+ # Default: true
548+ ignore-comments : false
549549
550550 ginkgolinter :
551551 # Suppress the wrong length assertion warning.
Original file line number Diff line number Diff line change 13191319 "ignore-comments" : {
13201320 "description" : " Ignore comments when counting lines." ,
13211321 "type" : " boolean" ,
1322- "default" : false
1322+ "default" : true
13231323 }
13241324 }
13251325 },
Original file line number Diff line number Diff line change 13191319 "ignore-comments" : {
13201320 "description" : " Ignore comments when counting lines." ,
13211321 "type" : " boolean" ,
1322- "default" : false
1322+ "default" : true
13231323 }
13241324 }
13251325 },
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ var defaultLintersSettings = LintersSettings{
4141 Forbidigo : ForbidigoSettings {
4242 ExcludeGodocExamples : true ,
4343 },
44+ Funlen : FunlenSettings {
45+ IgnoreComments : true ,
46+ },
4447 GoChecksumType : GoChecksumTypeSettings {
4548 DefaultSignifiesExhaustive : true ,
4649 },
Original file line number Diff line number Diff line change 11//golangcitest:args -Efunlen
22package testdata
33
4- // want +1 "Function 'main' is too long"
5- func main () {
6- // Comment 1
7- // Comment 2
8- // Comment 3
9- // Comment 4
10- // Comment 5
11- // Comment 6
12- // Comment 7
13- // Comment 8
14- // Comment 9
15- // Comment 10
16- // Comment 11
17- // Comment 12
18- // Comment 13
19- // Comment 14
20- // Comment 15
21- // Comment 16
22- // Comment 17
23- // Comment 18
24- // Comment 19
25- // Comment 20
26- // Comment 21
27- // Comment 22
28- // Comment 23
29- // Comment 24
30- // Comment 25
31- // Comment 26
32- // Comment 27
33- // Comment 28
34- // Comment 29
35- // Comment 30
36- // Comment 31
37- // Comment 32
38- // Comment 33
39- // Comment 34
40- // Comment 35
41- // Comment 36
42- // Comment 37
43- // Comment 38
44- // Comment 39
45- // Comment 40
46- // Comment 41
47- // Comment 42
48- // Comment 43
49- // Comment 44
50- // Comment 45
51- // Comment 46
52- // Comment 47
53- // Comment 48
54- // Comment 49
55- // Comment 50
56- // Comment 51
57- // Comment 52
58- // Comment 53
59- // Comment 54
60- // Comment 55
61- // Comment 56
62- // Comment 57
63- // Comment 58
64- // Comment 59
65- // Comment 60
66- print ("Hello, world!" )
4+ func TooManyLines () { // want `Function 'TooManyLines' is too long \(70 > 60\)`
5+ t := struct {
6+ A0 string
7+ A1 string
8+ A2 string
9+ A3 string
10+ A4 string
11+ A5 string
12+ A6 string
13+ A7 string
14+ A8 string
15+ A9 string
16+ A10 string
17+ A11 string
18+ A12 string
19+ A13 string
20+ A14 string
21+ A15 string
22+ A16 string
23+ A17 string
24+ A18 string
25+ A19 string
26+ A20 string
27+ A21 string
28+ A22 string
29+ A23 string
30+ A24 string
31+ A25 string
32+ A26 string
33+ A27 string
34+ A28 string
35+ A29 string
36+ A30 string
37+ A31 string
38+ A32 string
39+ }{
40+ A0 : "a" ,
41+ A1 : "a" ,
42+ A2 : "a" ,
43+ A3 : "a" ,
44+ A4 : "a" ,
45+ A5 : "a" ,
46+ A6 : "a" ,
47+ A7 : "a" ,
48+ A8 : "a" ,
49+ A9 : "a" ,
50+ A10 : "a" ,
51+ A11 : "a" ,
52+ A12 : "a" ,
53+ A13 : "a" ,
54+ A14 : "a" ,
55+ A15 : "a" ,
56+ A16 : "a" ,
57+ A17 : "a" ,
58+ A18 : "a" ,
59+ A19 : "a" ,
60+ A20 : "a" ,
61+ A21 : "a" ,
62+ A22 : "a" ,
63+ A23 : "a" ,
64+ A24 : "a" ,
65+ A25 : "a" ,
66+ A26 : "a" ,
67+ A27 : "a" ,
68+ A28 : "a" ,
69+ A29 : "a" ,
70+ A30 : "a" ,
71+ A31 : "a" ,
72+ A32 : "a" ,
73+ }
74+ _ = t
75+ }
76+
77+ func TooManyStatements () { // want `Function 'TooManyStatements' has too many statements \(46 > 40\)`
78+ a0 := 1
79+ a1 := 1
80+ a2 := 1
81+ a3 := 1
82+ a4 := 1
83+ a5 := 1
84+ a6 := 1
85+ a7 := 1
86+ a8 := 1
87+ a9 := 1
88+ a10 := 1
89+ a11 := 1
90+ a12 := 1
91+ a13 := 1
92+ a14 := 1
93+ a15 := 1
94+ a16 := 1
95+ a17 := 1
96+ a18 := 1
97+ a19 := 1
98+ a20 := 1
99+ a21 := 1
100+ a22 := 1
101+ _ = a0
102+ _ = a1
103+ _ = a2
104+ _ = a3
105+ _ = a4
106+ _ = a5
107+ _ = a6
108+ _ = a7
109+ _ = a8
110+ _ = a9
111+ _ = a10
112+ _ = a11
113+ _ = a12
114+ _ = a13
115+ _ = a14
116+ _ = a15
117+ _ = a16
118+ _ = a17
119+ _ = a18
120+ _ = a19
121+ _ = a20
122+ _ = a21
123+ _ = a22
67124}
You can’t perform that action at this time.
0 commit comments