/
nosnakecase.go
149 lines (111 loc) · 5.16 KB
/
nosnakecase.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
//golangcitest:args -Enosnakecase --internal-cmd-test
package testdata
import (
_ "fmt"
f_m_t "fmt" // ERROR "f_m_t contains underscore. You should use mixedCap or MixedCap."
)
// global variable name with underscore.
var v_v = 0 // ERROR "v_v contains underscore. You should use mixedCap or MixedCap."
// global constant name with underscore.
const c_c = 0 // ERROR "c_c contains underscore. You should use mixedCap or MixedCap."
// struct name with underscore.
type S_a struct { // ERROR "S_a contains underscore. You should use mixedCap or MixedCap."
fi int
}
// non-exported struct field name with underscore.
type Sa struct {
fi_a int // // ERROR "fi_a contains underscore. You should use mixedCap or MixedCap."
}
// function as struct field, with parameter name with underscore.
type Sb struct {
fib func(p_a int) // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
}
// exported struct field with underscore.
type Sc struct {
Fi_A int // ERROR "Fi_A contains underscore. You should use mixedCap or MixedCap."
}
// function as struct field, with return name with underscore.
type Sd struct {
fib func(p int) (r_a int) // ERROR "r_a contains underscore. You should use mixedCap or MixedCap."
}
// interface name with underscore.
type I_a interface { // ERROR "I_a contains underscore. You should use mixedCap or MixedCap."
fn(p int)
}
// interface with parameter name with underscore.
type Ia interface {
fn(p_a int) // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
}
// interface with parameter name with underscore.
type Ib interface {
Fn(p_a int) // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
}
// function as struct field, with return name with underscore.
type Ic interface {
Fn_a() // ERROR "Fn_a contains underscore. You should use mixedCap or MixedCap."
}
// interface with return name with underscore.
type Id interface {
Fn() (r_a int) // ERROR "r_a contains underscore. You should use mixedCap or MixedCap."
}
// function name with underscore.
func f_a() {} // ERROR "f_a contains underscore. You should use mixedCap or MixedCap."
// function's parameter name with underscore.
func fb(p_a int) {} // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
// named return with underscore.
func fc() (r_b int) { // ERROR "r_b contains underscore. You should use mixedCap or MixedCap."
return 0
}
// local variable (short declaration) with underscore.
func fd(p int) int {
v_b := p * 2 // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local constant with underscore.
func fe(p int) int {
const v_b = 2 // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local variable with underscore.
func ff(p int) int {
var v_b = 2 // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
}
// inner function, parameter name with underscore.
func fg() {
fgl := func(p_a int) {} // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
fgl(1)
}
type Foo struct{}
// method name with underscore.
func (f Foo) f_a() {} // ERROR "f_a contains underscore. You should use mixedCap or MixedCap."
// method's parameter name with underscore.
func (f Foo) fb(p_a int) {} // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
// named return with underscore.
func (f Foo) fc() (r_b int) { return 0 } // ERROR "r_b contains underscore. You should use mixedCap or MixedCap."
// local variable (short declaration) with underscore.
func (f Foo) fd(p int) int {
v_b := p * 2 // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local constant with underscore.
func (f Foo) fe(p int) int {
const v_b = 2 // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local variable with underscore.
func (f Foo) ff(p int) int {
var v_b = 2 // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // ERROR "v_b contains underscore. You should use mixedCap or MixedCap."
}
func fna(a, p_a int) {} // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
func fna1(a string, p_a int) {} // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
func fnb(a, b, p_a int) {} // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
func fnb1(a, b string, p_a int) {} // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
func fnd(
p_a int, // ERROR "p_a contains underscore. You should use mixedCap or MixedCap."
p_b int, // ERROR "p_b contains underscore. You should use mixedCap or MixedCap."
p_c int, // ERROR "p_c contains underscore. You should use mixedCap or MixedCap."
) {
f_m_t.Println("") // ERROR "f_m_t contains underscore. You should use mixedCap or MixedCap."
}