summaryrefslogtreecommitdiff
path: root/doc/doc/modules/luacov.reporter.html
blob: a2bd1cb44e2558fc671fdf69d666e020d3d950fd (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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>LuaCov Reference</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>LuaCov</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Class_ReporterBase">Class ReporterBase</a></li>
</ul>


<h2>Modules</h2>
<ul class="nowrap">
  <li><a href="../modules/luacov.html">luacov</a></li>
  <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li>
  <li><a href="../modules/luacov.hook.html">luacov.hook</a></li>
  <li><strong>luacov.reporter</strong></li>
  <li><a href="../modules/luacov.runner.html">luacov.runner</a></li>
  <li><a href="../modules/luacov.stats.html">luacov.stats</a></li>
  <li><a href="../modules/luacov.tick.html">luacov.tick</a></li>
  <li><a href="../modules/luacov.util.html">luacov.util</a></li>
</ul>

</div>

<div id="content">

<h1>Module <code>luacov.reporter</code></h1>
<p>Report module, will transform statistics file into a report.</p>
<p>

</p>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#report">report ([reporter_class])</a></td>
	<td class="summary">Runs the report generator.</td>
	</tr>
</table>
<h2><a href="#Class_ReporterBase">Class ReporterBase</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:config">ReporterBase:config ()</a></td>
	<td class="summary">Returns configuration table.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:max_hits">ReporterBase:max_hits ()</a></td>
	<td class="summary">Returns maximum number of hits per line in all coverage data.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:write">ReporterBase:write (...)</a></td>
	<td class="summary">Writes strings to report file.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:files">ReporterBase:files ()</a></td>
	<td class="summary">Returns array of filenames to be reported.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:stats">ReporterBase:stats (filename)</a></td>
	<td class="summary">Returns coverage data for a file.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_start">ReporterBase:on_start ()</a></td>
	<td class="summary">Stub method called before reporting.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_new_file">ReporterBase:on_new_file (filename)</a></td>
	<td class="summary">Stub method called before processing a file.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_file_error">ReporterBase:on_file_error (filename, error_type, message)</a></td>
	<td class="summary">Stub method called if a file couldn't be processed due to an error.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_empty_line">ReporterBase:on_empty_line (filename, lineno, line)</a></td>
	<td class="summary">Stub method called for each empty source line
 and other lines that can't be hit.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_mis_line">ReporterBase:on_mis_line (filename, lineno, line)</a></td>
	<td class="summary">Stub method called for each missed source line.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_hit_line">ReporterBase:on_hit_line (filename, lineno, line, hits)</a></td>
	<td class="summary">Stub method called for each hit source line.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_end_file">ReporterBase:on_end_file (filename, hits, miss)</a></td>
	<td class="summary">Stub method called after a file has been processed.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#ReporterBase:on_end">ReporterBase:on_end ()</a></td>
	<td class="summary">Stub method called after reporting.</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Functions"></a>Functions</h2>

    <dl class="function">
    <dt>
    <a name = "report"></a>
    <strong>report ([reporter_class])</strong>
    </dt>
    <dd>
    Runs the report generator.
 To load a config, use <a href="../modules/luacov.runner.html#load_config">luacov.runner.load_config</a> first.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">reporter_class</span>
         custom reporter class. Will be
 instantiated using 'new' method with configuration
 (see <a href="../modules/luacov.defaults.html#">luacov.defaults</a>) as the argument. It should
 return nil + error if something went wrong.
 After acquiring a reporter object its 'run' and 'close'
 methods will be called.
 The easiest way to implement a custom reporter class is to
 extend <a href="../modules/luacov.reporter.html#ReporterBase">ReporterBase</a>.
         (<em>optional</em>)
        </li>
    </ul>





</dd>
</dl>
    <h2 class="section-header has-description"><a name="Class_ReporterBase"></a>Class ReporterBase</h2>

          <div class="section-description">
          Basic reporter class stub.
 Implements 'new', 'run' and 'close' methods required by <a href="../modules/luacov.reporter.html#report">report</a>.
 Provides some helper methods and stubs to be overridden by child classes.
          </div>
            <h3>Usage:</h3>
            <pre class="example"><span class="keyword">local</span> MyReporter = <span class="global">setmetatable</span>({}, ReporterBase)
MyReporter.__index = MyReporter
<span class="keyword">function</span> MyReporter:on_hit_line(...)
   self:write((<span class="string">"File %s: hit line %s %d times"</span>):format(...))
<span class="keyword">end</span></pre>
    <dl class="function">
    <dt>
    <a name = "ReporterBase:config"></a>
    <strong>ReporterBase:config ()</strong>
    </dt>
    <dd>
    Returns configuration table.





    <h3>See also:</h3>
    <ul>
         <a href="../modules/luacov.defaults.html#">luacov.defaults</a>
    </ul>


</dd>
    <dt>
    <a name = "ReporterBase:max_hits"></a>
    <strong>ReporterBase:max_hits ()</strong>
    </dt>
    <dd>
    Returns maximum number of hits per line in all coverage data.







</dd>
    <dt>
    <a name = "ReporterBase:write"></a>
    <strong>ReporterBase:write (...)</strong>
    </dt>
    <dd>
    Writes strings to report file.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">...</span>
         strings.
        </li>
    </ul>





</dd>
    <dt>
    <a name = "ReporterBase:files"></a>
    <strong>ReporterBase:files ()</strong>
    </dt>
    <dd>
    Returns array of filenames to be reported.







</dd>
    <dt>
    <a name = "ReporterBase:stats"></a>
    <strong>ReporterBase:stats (filename)</strong>
    </dt>
    <dd>
    Returns coverage data for a file.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>
         name of the file.
        </li>
    </ul>



    <h3>See also:</h3>
    <ul>
         <a href="../modules/luacov.stats.html#load">luacov.stats.load</a>
    </ul>


</dd>
    <dt>
    <a name = "ReporterBase:on_start"></a>
    <strong>ReporterBase:on_start ()</strong>
    </dt>
    <dd>
    Stub method called before reporting.







</dd>
    <dt>
    <a name = "ReporterBase:on_new_file"></a>
    <strong>ReporterBase:on_new_file (filename)</strong>
    </dt>
    <dd>
    Stub method called before processing a file.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>
         name of the file.
        </li>
    </ul>





</dd>
    <dt>
    <a name = "ReporterBase:on_file_error"></a>
    <strong>ReporterBase:on_file_error (filename, error_type, message)</strong>
    </dt>
    <dd>
    Stub method called if a file couldn't be processed due to an error.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>
         name of the file.
        </li>
        <li><span class="parameter">error_type</span>
         "open", "read" or "load".
        </li>
        <li><span class="parameter">message</span>
         error message.
        </li>
    </ul>





</dd>
    <dt>
    <a name = "ReporterBase:on_empty_line"></a>
    <strong>ReporterBase:on_empty_line (filename, lineno, line)</strong>
    </dt>
    <dd>
    Stub method called for each empty source line
 and other lines that can't be hit.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>
         name of the file.
        </li>
        <li><span class="parameter">lineno</span>
         line number.
        </li>
        <li><span class="parameter">line</span>
         the line itself as a string.
        </li>
    </ul>





</dd>
    <dt>
    <a name = "ReporterBase:on_mis_line"></a>
    <strong>ReporterBase:on_mis_line (filename, lineno, line)</strong>
    </dt>
    <dd>
    Stub method called for each missed source line.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>
         name of the file.
        </li>
        <li><span class="parameter">lineno</span>
         line number.
        </li>
        <li><span class="parameter">line</span>
         the line itself as a string.
        </li>
    </ul>





</dd>
    <dt>
    <a name = "ReporterBase:on_hit_line"></a>
    <strong>ReporterBase:on_hit_line (filename, lineno, line, hits)</strong>
    </dt>
    <dd>
    Stub method called for each hit source line.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>
         name of the file.
        </li>
        <li><span class="parameter">lineno</span>
         line number.
        </li>
        <li><span class="parameter">line</span>
         the line itself as a string.
        </li>
        <li><span class="parameter">hits</span>
         number of times the line was hit. Should be positive.
        </li>
    </ul>





</dd>
    <dt>
    <a name = "ReporterBase:on_end_file"></a>
    <strong>ReporterBase:on_end_file (filename, hits, miss)</strong>
    </dt>
    <dd>
    Stub method called after a file has been processed.


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>
         name of the file.
        </li>
        <li><span class="parameter">hits</span>
         total number of hit lines in the file.
        </li>
        <li><span class="parameter">miss</span>
         total number of missed lines in the file.
        </li>
    </ul>





</dd>
    <dt>
    <a name = "ReporterBase:on_end"></a>
    <strong>ReporterBase:on_end ()</strong>
    </dt>
    <dd>
    Stub method called after reporting.







</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i>
<i style="float:right;">Last updated 2016-06-29 18:46:30 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>