|
1 |
| -// args: -Enosnakecase |
| 1 | +//args: -Enosnakecase |
2 | 2 | package testdata
|
3 | 3 |
|
4 |
| -func a_() { // ERROR "a_ is used under score. You should use mixedCap or MixedCap." |
| 4 | +import ( |
| 5 | + _ "fmt" |
| 6 | + f_m_t "fmt" // ERROR "f_m_t is used under score. You should use mixedCap or MixedCap." |
| 7 | +) |
| 8 | + |
| 9 | +// global variable name with underscore. |
| 10 | +var v_v = 0 // ERROR "v_v is used under score. You should use mixedCap or MixedCap." |
| 11 | + |
| 12 | +// global constant name with underscore. |
| 13 | +const c_c = 0 // ERROR "c_c is used under score. You should use mixedCap or MixedCap." |
| 14 | + |
| 15 | +// struct name with underscore. |
| 16 | +type S_a struct { // ERROR "S_a is used under score. You should use mixedCap or MixedCap." |
| 17 | + fi int |
| 18 | +} |
| 19 | + |
| 20 | +// non-exported struct field name with underscore. |
| 21 | +type Sa struct { |
| 22 | + fi_a int // // ERROR "fi_a is used under score. You should use mixedCap or MixedCap." |
| 23 | +} |
| 24 | + |
| 25 | +// function as struct field, with parameter name with underscore. |
| 26 | +type Sb struct { |
| 27 | + fib func(p_a int) // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 28 | +} |
| 29 | + |
| 30 | +// exported struct field with underscore. |
| 31 | +type Sc struct { |
| 32 | + Fi_A int // ERROR "Fi_A is used under score. You should use mixedCap or MixedCap." |
| 33 | +} |
| 34 | + |
| 35 | +// function as struct field, with return name with underscore. |
| 36 | +type Sd struct { |
| 37 | + fib func(p int) (r_a int) // ERROR "r_a is used under score. You should use mixedCap or MixedCap." |
| 38 | +} |
| 39 | + |
| 40 | +// interface name with underscore. |
| 41 | +type I_a interface { // ERROR "I_a is used under score. You should use mixedCap or MixedCap." |
| 42 | + fn(p int) |
5 | 43 | }
|
6 | 44 |
|
7 |
| -func b(a_a int) { // ERROR "a_a is used under score. You should use mixedCap or MixedCap." |
| 45 | +// interface with parameter name with underscore. |
| 46 | +type Ia interface { |
| 47 | + fn(p_a int) // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
8 | 48 | }
|
9 | 49 |
|
10 |
| -func c() (c_c int) { // ERROR "c_c is used under score. You should use mixedCap or MixedCap." |
11 |
| - c_c = 1 // ERROR "c_c is used under score. You should use mixedCap or MixedCap." |
12 |
| - return c_c // It's never detected, because `c_c` is already detected. |
| 50 | +// interface with parameter name with underscore. |
| 51 | +type Ib interface { |
| 52 | + Fn(p_a int) // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
13 | 53 | }
|
14 | 54 |
|
15 |
| -func d() { |
16 |
| - var d_d int // ERROR "d_d is used under score. You should use mixedCap or MixedCap." |
17 |
| - _ = d_d // It's never detected, because `_` is meaningful in Go and `d_d` is already detected. |
| 55 | +// function as struct field, with return name with underscore. |
| 56 | +type Ic interface { |
| 57 | + Fn_a() // ERROR "Fn_a is used under score. You should use mixedCap or MixedCap." |
| 58 | +} |
| 59 | + |
| 60 | +// interface with return name with underscore. |
| 61 | +type Id interface { |
| 62 | + Fn() (r_a int) // ERROR "r_a is used under score. You should use mixedCap or MixedCap." |
| 63 | +} |
| 64 | + |
| 65 | +// function name with underscore. |
| 66 | +func f_a() {} // ERROR "f_a is used under score. You should use mixedCap or MixedCap." |
| 67 | + |
| 68 | +// function's parameter name with underscore. |
| 69 | +func fb(p_a int) {} // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 70 | + |
| 71 | +// named return with underscore. |
| 72 | +func fc() (r_b int) { // ERROR "r_b is used under score. You should use mixedCap or MixedCap." |
| 73 | + return 0 |
| 74 | +} |
| 75 | + |
| 76 | +// local variable (short declaration) with underscore. |
| 77 | +func fd(p int) int { |
| 78 | + v_b := p * 2 // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 79 | + |
| 80 | + return v_b // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 81 | +} |
| 82 | + |
| 83 | +// local constant with underscore. |
| 84 | +func fe(p int) int { |
| 85 | + const v_b = 2 // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 86 | + |
| 87 | + return v_b * p // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 88 | +} |
| 89 | + |
| 90 | +// local variable with underscore. |
| 91 | +func ff(p int) int { |
| 92 | + var v_b = 2 // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 93 | + |
| 94 | + return v_b * p // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 95 | +} |
| 96 | + |
| 97 | +// inner function, parameter name with underscore. |
| 98 | +func fg() { |
| 99 | + fgl := func(p_a int) {} // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 100 | + fgl(1) |
| 101 | +} |
| 102 | + |
| 103 | +type Foo struct{} |
| 104 | + |
| 105 | +// method name with underscore. |
| 106 | +func (f Foo) f_a() {} // ERROR "f_a is used under score. You should use mixedCap or MixedCap." |
| 107 | + |
| 108 | +// method's parameter name with underscore. |
| 109 | +func (f Foo) fb(p_a int) {} // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 110 | + |
| 111 | +// named return with underscore. |
| 112 | +func (f Foo) fc() (r_b int) { return 0 } // ERROR "r_b is used under score. You should use mixedCap or MixedCap." |
| 113 | + |
| 114 | +// local variable (short declaration) with underscore. |
| 115 | +func (f Foo) fd(p int) int { |
| 116 | + v_b := p * 2 // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 117 | + |
| 118 | + return v_b // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 119 | +} |
| 120 | + |
| 121 | +// local constant with underscore. |
| 122 | +func (f Foo) fe(p int) int { |
| 123 | + const v_b = 2 // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 124 | + |
| 125 | + return v_b * p // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 126 | +} |
| 127 | + |
| 128 | +// local variable with underscore. |
| 129 | +func (f Foo) ff(p int) int { |
| 130 | + var v_b = 2 // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 131 | + |
| 132 | + return v_b * p // ERROR "v_b is used under score. You should use mixedCap or MixedCap." |
| 133 | +} |
| 134 | + |
| 135 | +func fna(a, p_a int) {} // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 136 | + |
| 137 | +func fna1(a string, p_a int) {} // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 138 | + |
| 139 | +func fnb(a, b, p_a int) {} // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 140 | + |
| 141 | +func fnb1(a, b string, p_a int) {} // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 142 | + |
| 143 | +func fnd( |
| 144 | + p_a int, // ERROR "p_a is used under score. You should use mixedCap or MixedCap." |
| 145 | + p_b int, // ERROR "p_b is used under score. You should use mixedCap or MixedCap." |
| 146 | + p_c int, // ERROR "p_c is used under score. You should use mixedCap or MixedCap." |
| 147 | +) { |
| 148 | + f_m_t.Println("") // ERROR "f_m_t is used under score. You should use mixedCap or MixedCap." |
18 | 149 | }
|
0 commit comments