Skip to content

Commit

Permalink
fix --level=error : output fix #209
Browse files Browse the repository at this point in the history
  • Loading branch information
rrd108 committed Sep 3, 2024
1 parent 69ee4e6 commit 8b77620
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions dist/vue-mess-detector.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -3334,14 +3334,13 @@ const Bo = (t, e) => {
}), h = {};
return a.forEach((p) => {
h[p] = [], s[p].forEach((d, x) => {
h[p][x] = { id: "", description: "", message: "" };
const y = d.message.includes(G);
if (u.some((E) => E.file === d.file)) {
const E = u.find((C) => C.file === d.file);
E && (y ? E.errors++ : E.warnings++);
} else
u.push({ file: d.file, errors: y ? 1 : 0, warnings: y ? 0 : 1 });
n === "error" && !y || (t === "file" && (h[p][x].id = d.rule), t !== "file" && (h[p][x].id = d.file), h[p][x].description = d.description, h[p][x].message = d.message || "🚨");
n === "error" && !y || (h[p][x] = { id: "", description: "", message: "" }, t === "file" && (h[p][x].id = d.rule), t !== "file" && (h[p][x].id = d.file), h[p][x].description = d.description, h[p][x].message = d.message || "🚨");
});
}), { output: h, health: u };
}, fe = {
Expand Down
4 changes: 2 additions & 2 deletions src/rulesReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export const reportRules = (groupBy: GroupBy, orderBy: OrderBy, level: OutputLev
output[key] = []

offensesGrouped[key].forEach((offense, i) => {
output[key][i] = { id: '', description: '', message: '' }
const isError = offense.message.includes(BG_ERR)
// if health already has the file, push the error
if (health.some(h => h.file === offense.file)) {
Expand All @@ -120,6 +119,8 @@ export const reportRules = (groupBy: GroupBy, orderBy: OrderBy, level: OutputLev
return
}

output[key][i] = { id: '', description: '', message: '' }

if (groupBy === 'file') {
// output.push({ info: ` Rule: ${offense.rule}` })
output[key][i].id = offense.rule
Expand All @@ -136,6 +137,5 @@ export const reportRules = (groupBy: GroupBy, orderBy: OrderBy, level: OutputLev
})
})

// console.log(JSON.stringify(output, null, 2));
return { output, health }
}

0 comments on commit 8b77620

Please sign in to comment.