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