You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/golinters/nolintlint/nolintlint_test.go
+18-20
Original file line number
Diff line number
Diff line change
@@ -40,10 +40,10 @@ func foo() {
40
40
other() //nolintother
41
41
}`,
42
42
expected: []issueWithReplacement{
43
-
{"directive `//nolint` should provide explanation such as `//nolint // this is why` at testing.go:5:1", nil},
44
-
{"directive `//nolint` should provide explanation such as `//nolint // this is why` at testing.go:7:9", nil},
45
-
{"directive `//nolint //` should provide explanation such as `//nolint // this is why` at testing.go:8:9", nil},
46
-
{"directive `//nolint // ` should provide explanation such as `//nolint // this is why` at testing.go:9:9", nil},
43
+
{issue: "directive `//nolint` should provide explanation such as `//nolint // this is why` at testing.go:5:1"},
44
+
{issue: "directive `//nolint` should provide explanation such as `//nolint // this is why` at testing.go:7:9"},
45
+
{issue: "directive `//nolint //` should provide explanation such as `//nolint // this is why` at testing.go:8:9"},
46
+
{issue: "directive `//nolint // ` should provide explanation such as `//nolint // this is why` at testing.go:9:9"},
47
47
},
48
48
},
49
49
{
@@ -57,7 +57,7 @@ package bar
57
57
//nolint:dupl
58
58
func foo() {}`,
59
59
expected: []issueWithReplacement{
60
-
{"directive `//nolint:dupl` should provide explanation such as `//nolint:dupl // this is why` at testing.go:6:1", nil},
60
+
{issue: "directive `//nolint:dupl` should provide explanation such as `//nolint:dupl // this is why` at testing.go:6:1"},
61
61
},
62
62
},
63
63
{
@@ -83,8 +83,8 @@ func foo() {
83
83
bad() // nolint // because
84
84
}`,
85
85
expected: []issueWithReplacement{
86
-
{"directive `//nolint` should mention specific linter such as `//nolint:my-linter` at testing.go:6:9", nil},
87
-
{"directive `// nolint // because` should mention specific linter such as `// nolint:my-linter` at testing.go:7:9", nil},
86
+
{issue: "directive `//nolint` should mention specific linter such as `//nolint:my-linter` at testing.go:6:9"},
87
+
{issue: "directive `// nolint // because` should mention specific linter such as `// nolint:my-linter` at testing.go:7:9"},
88
88
},
89
89
},
90
90
{
@@ -99,8 +99,8 @@ func foo() {
99
99
}`,
100
100
expected: []issueWithReplacement{
101
101
{
102
-
"directive `// nolint` should be written without leading space as `//nolint` at testing.go:5:9",
103
-
&result.Replacement{
102
+
issue: "directive `// nolint` should be written without leading space as `//nolint` at testing.go:5:9",
103
+
replacement: &result.Replacement{
104
104
Inline: &result.InlineFix{
105
105
StartCol: 10,
106
106
Length: 1,
@@ -121,8 +121,8 @@ func foo() {
121
121
}`,
122
122
expected: []issueWithReplacement{
123
123
{
124
-
"directive `// nolint` should not have more than one leading space at testing.go:5:9",
125
-
&result.Replacement{
124
+
issue: "directive `// nolint` should not have more than one leading space at testing.go:5:9",
125
+
replacement: &result.Replacement{
126
126
Inline: &result.InlineFix{
127
127
StartCol: 10,
128
128
Length: 2,
@@ -144,7 +144,7 @@ func foo() {
144
144
good() // nolint: linter1, linter2
145
145
}`,
146
146
expected: []issueWithReplacement{
147
-
{"directive `// nolint:linter1 linter2` should match `// nolint[:<comma-separated-linters>] [// <explanation>]` at testing.go:6:9", nil}, //nolint:lll // this is a string
147
+
{issue: "directive `// nolint:linter1 linter2` should match `// nolint[:<comma-separated-linters>] [// <explanation>]` at testing.go:6:9"}, //nolint:lll // this is a string
148
148
},
149
149
},
150
150
{
@@ -168,8 +168,8 @@ func foo() {
168
168
}`,
169
169
expected: []issueWithReplacement{
170
170
{
171
-
"directive `//nolint` is unused at testing.go:5:9",
172
-
&result.Replacement{
171
+
issue: "directive `//nolint` is unused at testing.go:5:9",
172
+
replacement: &result.Replacement{
173
173
Inline: &result.InlineFix{
174
174
StartCol: 8,
175
175
Length: 8,
@@ -190,8 +190,8 @@ func foo() {
190
190
}`,
191
191
expected: []issueWithReplacement{
192
192
{
193
-
"directive `//nolint:somelinter` is unused for linter \"somelinter\" at testing.go:5:9",
194
-
&result.Replacement{
193
+
issue: "directive `//nolint:somelinter` is unused for linter \"somelinter\" at testing.go:5:9",
194
+
replacement: &result.Replacement{
195
195
Inline: &result.InlineFix{
196
196
StartCol: 8,
197
197
Length: 19,
@@ -212,12 +212,10 @@ func foo() {
212
212
}`,
213
213
expected: []issueWithReplacement{
214
214
{
215
-
"directive `//nolint:linter1,linter2` is unused for linter \"linter1\" at testing.go:5:9",
216
-
nil,
215
+
issue: "directive `//nolint:linter1,linter2` is unused for linter \"linter1\" at testing.go:5:9",
217
216
},
218
217
{
219
-
"directive `//nolint:linter1,linter2` is unused for linter \"linter2\" at testing.go:5:9",
220
-
nil,
218
+
issue: "directive `//nolint:linter1,linter2` is unused for linter \"linter2\" at testing.go:5:9",
0 commit comments