File tree Expand file tree Collapse file tree 7 files changed +243
-63
lines changed
Expand file tree Collapse file tree 7 files changed +243
-63
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ func New(settings *config.FunlenSettings) *goanalysis.Linter {
1919 if settings != nil {
2020 cfg .lineLimit = settings .Lines
2121 cfg .stmtLimit = settings .Statements
22- cfg .ignoreComments = ! settings .IgnoreComments
22+ cfg .ignoreComments = settings .IgnoreComments
2323 }
2424
2525 a := funlen .NewAnalyzer (cfg .lineLimit , cfg .stmtLimit , cfg .ignoreComments )
Original file line number Diff line number Diff line change 11//golangcitest:args -Efunlen
2- //golangcitest:config_path testdata/funlen.yml
32package testdata
43
5- func TooManyLines () { // want `Function 'TooManyLines' is too long \(22 > 20\)`
6- t := struct {
7- A string
8- B string
9- C string
10- D string
11- E string
12- F string
13- G string
14- H string
15- I string
16- }{
17- `a` ,
18- `b` ,
19- `c` ,
20- `d` ,
21- `e` ,
22- `f` ,
23- `g` ,
24- `h` ,
25- `i` ,
26- }
27- _ = t
28- }
29-
30- func TooManyStatements () { // want `Function 'TooManyStatements' has too many statements \(11 > 10\)`
31- a := 1
32- b := a
33- c := b
34- d := c
35- e := d
36- f := e
37- g := f
38- h := g
39- i := h
40- j := i
41- _ = j
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!" )
4267}
Original file line number Diff line number Diff line change 11//golangcitest:args -Efunlen
2- //golangcitest:config_path testdata/funlen.yml
32package testdata
43
54/*
@@ -22,27 +21,67 @@ func _() {
2221 C .free (unsafe .Pointer (cs ))
2322}
2423
25- func _ () { // want `Function '_' is too long \(22 > 20\)`
26- t := struct {
27- A string
28- B string
29- C string
30- D string
31- E string
32- F string
33- G string
34- H string
35- I string
36- }{
37- `a` ,
38- `b` ,
39- `c` ,
40- `d` ,
41- `e` ,
42- `f` ,
43- `g` ,
44- `h` ,
45- `i` ,
46- }
47- _ = t
24+ // want +1 "Function 'main' is too long"
25+ func main () {
26+ // Comment 1
27+ // Comment 2
28+ // Comment 3
29+ // Comment 4
30+ // Comment 5
31+ // Comment 6
32+ // Comment 7
33+ // Comment 8
34+ // Comment 9
35+ // Comment 10
36+ // Comment 11
37+ // Comment 12
38+ // Comment 13
39+ // Comment 14
40+ // Comment 15
41+ // Comment 16
42+ // Comment 17
43+ // Comment 18
44+ // Comment 19
45+ // Comment 20
46+ // Comment 21
47+ // Comment 22
48+ // Comment 23
49+ // Comment 24
50+ // Comment 25
51+ // Comment 26
52+ // Comment 27
53+ // Comment 28
54+ // Comment 29
55+ // Comment 30
56+ // Comment 31
57+ // Comment 32
58+ // Comment 33
59+ // Comment 34
60+ // Comment 35
61+ // Comment 36
62+ // Comment 37
63+ // Comment 38
64+ // Comment 39
65+ // Comment 40
66+ // Comment 41
67+ // Comment 42
68+ // Comment 43
69+ // Comment 44
70+ // Comment 45
71+ // Comment 46
72+ // Comment 47
73+ // Comment 48
74+ // Comment 49
75+ // Comment 50
76+ // Comment 51
77+ // Comment 52
78+ // Comment 53
79+ // Comment 54
80+ // Comment 55
81+ // Comment 56
82+ // Comment 57
83+ // Comment 58
84+ // Comment 59
85+ // Comment 60
86+ print ("Hello, world!" )
4887}
Original file line number Diff line number Diff line change 1+ //golangcitest:args -Efunlen
2+ //golangcitest:config_path testdata/funlen_custom.yml
3+ package testdata
4+
5+ func TooManyLines () { // want `Function 'TooManyLines' is too long \(22 > 20\)`
6+ t := struct {
7+ A string
8+ B string
9+ C string
10+ D string
11+ E string
12+ F string
13+ G string
14+ H string
15+ I string
16+ }{
17+ `a` ,
18+ `b` ,
19+ `c` ,
20+ `d` ,
21+ `e` ,
22+ `f` ,
23+ `g` ,
24+ `h` ,
25+ `i` ,
26+ }
27+ _ = t
28+ }
29+
30+ func TooManyStatements () { // want `Function 'TooManyStatements' has too many statements \(11 > 10\)`
31+ a := 1
32+ b := a
33+ c := b
34+ d := c
35+ e := d
36+ f := e
37+ g := f
38+ h := g
39+ i := h
40+ j := i
41+ _ = j
42+ }
File renamed without changes.
Original file line number Diff line number Diff line change 1+ //golangcitest:args -Efunlen
2+ //golangcitest:config_path testdata/funlen_ignore_comments.yml
3+ //golangcitest:expected_exitcode 0
4+ package testdata
5+
6+ func main () {
7+ // Comment 1
8+ // Comment 2
9+ // Comment 3
10+ // Comment 4
11+ // Comment 5
12+ // Comment 6
13+ // Comment 7
14+ // Comment 8
15+ // Comment 9
16+ // Comment 10
17+ // Comment 11
18+ // Comment 12
19+ // Comment 13
20+ // Comment 14
21+ // Comment 15
22+ // Comment 16
23+ // Comment 17
24+ // Comment 18
25+ // Comment 19
26+ // Comment 20
27+ // Comment 21
28+ // Comment 22
29+ // Comment 23
30+ // Comment 24
31+ // Comment 25
32+ // Comment 26
33+ // Comment 27
34+ // Comment 28
35+ // Comment 29
36+ // Comment 30
37+ // Comment 31
38+ // Comment 32
39+ // Comment 33
40+ // Comment 34
41+ // Comment 35
42+ // Comment 36
43+ // Comment 37
44+ // Comment 38
45+ // Comment 39
46+ // Comment 40
47+ // Comment 41
48+ // Comment 42
49+ // Comment 43
50+ // Comment 44
51+ // Comment 45
52+ // Comment 46
53+ // Comment 47
54+ // Comment 48
55+ // Comment 49
56+ // Comment 50
57+ // Comment 51
58+ // Comment 52
59+ // Comment 53
60+ // Comment 54
61+ // Comment 55
62+ // Comment 56
63+ // Comment 57
64+ // Comment 58
65+ // Comment 59
66+ // Comment 60
67+ print ("Hello, world!" )
68+ }
Original file line number Diff line number Diff line change 1+ version : " 2"
2+
3+ linters :
4+ settings :
5+ funlen :
6+ ignore-comments : true
You can’t perform that action at this time.
0 commit comments