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