summaryrefslogtreecommitdiff
path: root/test/handler/test_common_handlers.vader
blob: 0a83f944ef27b50676c106e1f51651bdf25fe32e (plain)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
Execute(HandleCSSLintFormat should handle CSS errors):
  AssertEqual
  \ [
  \   {
  \     'lnum': 2,
  \     'col': 1,
  \     'type': 'E',
  \     'text': '(errors) Expected RBRACE at line 2, col 1.',
  \   },
  \   {
  \    'lnum': 2,
  \    'col': 5,
  \    'type': 'W',
  \    'text': '(known-properties) Expected ... but found ''wat''.',
  \   },
  \ ],
  \ ale#handlers#css#HandleCSSLintFormat(42, [
  \   'something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors)',
  \   'something.css: line 2, col 5, Warning - Expected ... but found ''wat''. (known-properties)',
  \ ])

Execute(HandleCSSLintFormat should handle CSS errors without groups):
  AssertEqual
  \ [
  \   {
  \    'lnum': 7,
  \    'col': 3,
  \    'type': 'W',
  \    'text': 'Unknown property ''fill''.',
  \   },
  \   {
  \    'lnum': 8,
  \    'col': 3,
  \    'type': 'W',
  \    'text': 'Unknown property ''fill-opacity''.',
  \   },
  \ ],
  \ ale#handlers#css#HandleCSSLintFormat(42, [
  \   'something.css: line 7, col 3, Warning - Unknown property ''fill''.',
  \   'something.css: line 8, col 3, Warning - Unknown property ''fill-opacity''.',
  \ ])

Execute (HandlePEP8Format should handle the correct lines of output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 6,
  \     'col': 6,
  \     'type': 'E',
  \     'text': 'E111: indentation is not a multiple of four',
  \   },
  \   {
  \    'lnum': 35,
  \    'col': 0,
  \    'type': 'E',
  \    'text': "EANSIBLE0002: Trailing whitespace",
  \   },
  \ ],
  \ ale#handlers#python#HandlePEP8Format(42, [
  \   "stdin:6:6: E111 indentation is not a multiple of four",
  \   "test.yml:35: [EANSIBLE0002] Trailing whitespace",
  \ ])

Execute (HandlePEP8Format should handle names with spaces):
  AssertEqual
  \ [
  \   {
  \     'lnum': 6,
  \     'col': 6,
  \     'type': 'E',
  \     'text': 'E111: indentation is not a multiple of four',
  \   },
  \ ],
  \ ale#handlers#python#HandlePEP8Format(42, [
  \   'C:\something\with spaces.py:6:6: E111 indentation is not a multiple of four',
  \ ])

Execute (HandlePEP8Format should stack traces):
  AssertEqual
  \ [
  \   {
  \     'lnum': 1,
  \     'text': 'An exception was thrown. See :ALEDetail',
  \     'detail': join([
  \       'Traceback (most recent call last):',
  \       '  File "/usr/local/bin/flake8", line 7, in <module>',
  \       '    from flake8.main.cli import main',
  \       '  File "/usr/local/lib/python2.7/dist-packages/flake8/main/cli.py", line 2, in <module>',
  \       '    from flake8.main import application',
  \       '  File "/usr/local/lib/python2.7/dist-packages/flake8/main/application.py", line 17, in <module>',
  \       '    from flake8.plugins import manager as plugin_manager',
  \       '  File "/usr/local/lib/python2.7/dist-packages/flake8/plugins/manager.py", line 5, in <module>',
  \       '    import pkg_resources',
  \       '  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in <module>',
  \       '    import email.parser',
  \       'ImportError: No module named parser',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#python#HandlePEP8Format(42, [
  \   'Traceback (most recent call last):',
  \   '  File "/usr/local/bin/flake8", line 7, in <module>',
  \   '    from flake8.main.cli import main',
  \   '  File "/usr/local/lib/python2.7/dist-packages/flake8/main/cli.py", line 2, in <module>',
  \   '    from flake8.main import application',
  \   '  File "/usr/local/lib/python2.7/dist-packages/flake8/main/application.py", line 17, in <module>',
  \   '    from flake8.plugins import manager as plugin_manager',
  \   '  File "/usr/local/lib/python2.7/dist-packages/flake8/plugins/manager.py", line 5, in <module>',
  \   '    import pkg_resources',
  \   '  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in <module>',
  \   '    import email.parser',
  \   'ImportError: No module named parser',
  \ ])

Execute (HandleGCCFormat should handle the correct lines of output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 8,
  \     'col': 5,
  \     'type': 'W',
  \     'text': 'conversion lacks type at end of format [-Wformat=]',
  \   },
  \   {
  \     'lnum': 10,
  \     'col': 27,
  \     'type': 'E',
  \     'text': 'invalid operands to binary - (have ''int'' and ''char *'')',
  \   },
  \ ],
  \ ale#handlers#gcc#HandleGCCFormat(42, [
  \   '<stdin>:8:5: warning: conversion lacks type at end of format [-Wformat=]',
  \   '<stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’)',
  \ ])

Execute (HandleGCCFormat should replace Unicode quotes):
  AssertEqual
  \ [
  \   {
  \     'lnum': 8,
  \     'col': 5,
  \     'type': 'W',
  \     'text': "'''' \"\"",
  \   },
  \ ],
  \ ale#handlers#gcc#HandleGCCFormat(42, ['<stdin>:8:5: warning: `´‘’ “”'])

Execute (HandleUnixFormatAsError should handle some example lines of output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 27,
  \     'col': 0,
  \     'type': 'E',
  \     'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
  \   },
  \   {
  \     'lnum': 53,
  \     'col': 10,
  \     'type': 'E',
  \     'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
  \   },
  \   {
  \     'lnum': 1,
  \     'col': 1,
  \     'type': 'E',
  \     'text': '".b" is not a valid class name.  Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
  \   },
  \ ],
  \ ale#handlers#unix#HandleAsError(42, [
  \   'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
  \   'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
  \   'test.pug:1:1 ".b" is not a valid class name.  Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.',
  \ ])

Execute (HandleUnixFormatAsError should handle lines with no space after the colon):
  AssertEqual
  \ [
  \   {
  \     'lnum': 27,
  \     'col': 0,
  \     'type': 'E',
  \     'text': 'foo',
  \   },
  \   {
  \     'lnum': 53,
  \     'col': 10,
  \     'type': 'E',
  \     'text': 'bar',
  \   },
  \ ],
  \ ale#handlers#unix#HandleAsError(42, [
  \   'some_file.xyz:27:foo',
  \   'some_file.xyz:53:10:bar',
  \ ])

Execute (HandleUnixFormatAsError should handle names with spaces):
  AssertEqual
  \ [
  \   {
  \     'lnum': 13,
  \     'col': 90,
  \     'type': 'E',
  \     'text': 'leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.',
  \   },
  \ ],
  \ ale#handlers#unix#HandleAsError(42, [
  \   '/Users/rrj/Notes/Astro/Taurus December SM.txt:13:90: leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.',
  \ ])

Execute (HandleUnixFormatAsWarning should handle some example lines of output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 27,
  \     'col': 0,
  \     'type': 'W',
  \     'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
  \   },
  \   {
  \     'lnum': 53,
  \     'col': 10,
  \     'type': 'W',
  \     'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
  \   },
  \ ],
  \ ale#handlers#unix#HandleAsWarning(42, [
  \   'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
  \   'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)',
  \ ])

Execute (Unix format functions should handle Windows paths):
  AssertEqual
  \ [
  \   {
  \     'lnum': 27,
  \     'col': 0,
  \     'type': 'E',
  \     'text': 'foo',
  \   },
  \   {
  \     'lnum': 53,
  \     'col': 10,
  \     'type': 'E',
  \     'text': 'foo',
  \   },
  \ ],
  \ ale#handlers#unix#HandleAsError(42, [
  \   'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:27: foo',
  \   'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:53:10: foo',
  \ ])

Execute (HandleCppCheckFormat should handle some example lines of output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 5,
  \     'col': 0,
  \     'type': 'W',
  \     'text': 'Variable a is assigned a value that is never used. (style)',
  \   },
  \   {
  \     'lnum': 12,
  \     'col': 0,
  \     'type': 'E',
  \     'text': 'Array a[10] accessed at index 10, which is out of bounds. (error)',
  \   },
  \ ],
  \ ale#handlers#cppcheck#HandleCppCheckFormat(42, [
  \   '[/tmp/test.c:5]: (style) Variable a is assigned a value that is never used.',
  \   '[/tmp/test.c:12]: (error) Array a[10] accessed at index 10, which is out of bounds.'
  \ ])