1 | 'use strict';
|
2 |
|
3 | const _ = require('lodash');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | const unixFormatter = (results) => {
|
10 | const lines = _.flatMap(results, (result) =>
|
11 | result.warnings.map(
|
12 | (warning) =>
|
13 | `${result.source}:${warning.line}:${warning.column}: ` +
|
14 | `${warning.text} [${warning.severity}]\n`,
|
15 | ),
|
16 | );
|
17 | const total = lines.length;
|
18 | let output = lines.join('');
|
19 |
|
20 | if (total > 0) {
|
21 | output += `\n${total} problem${total !== 1 ? 's' : ''}\n`;
|
22 | }
|
23 |
|
24 | return output;
|
25 | };
|
26 |
|
27 | module.exports = unixFormatter;
|