1 module.exports = function (results) {
2 results = results || [];
9 results.reduce((result, current) => {
10 current.messages.forEach((msg) => {
11 if (msg.severity === 1) {
12 errorType.warnings[msg.ruleId] = errorType.warnings[msg.ruleId] + 1 || 1
14 if (msg.severity === 2) {
15 errorType.errors[msg.ruleId] = errorType.errors[msg.ruleId] + 1 || 1
21 const reduceErrorCounts = (errorType) => Object.entries(errorType).sort((a, b) => b[1] - a[1])
22 .reduce((result, current) => result.concat([`${current[0]}: ${current[1]}`]), []).join('\n');
24 const warnings = reduceErrorCounts(errorType.warnings);
25 const errors = reduceErrorCounts(errorType.errors);