Skip to content

Commit

Permalink
reporters: use Object.entries
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Feb 9, 2022
1 parent e29273e commit 88ceebd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/reporters/checkstyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ function checkstyle(results) {

out.push('<?xml version="1.0" encoding="utf-8"?><checkstyle>');

for (const file of Object.keys(files)) {
for (const [file, errors] of Object.entries(files)) {
out.push(`\t<file name="${file}">`);

for (const issue of files[file]) {
out.push(`\t\t<error line="${issue.line}" column="${issue.column}" severity="${issue.severity}" message="${encode(issue.message)}" source="${issue.source}" />`);
for (const error of errors) {
out.push(`\t\t<error line="${error.line}" column="${error.column}" severity="${error.severity}" message="${encode(error.message)}" source="${error.source}" />`);
}

out.push('\t</file>');
Expand Down
6 changes: 2 additions & 4 deletions lib/reporters/junit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ function junit(results) {
});
}

const filesArray = Object.keys(files);
const filesArray = Object.entries(files);

out.push(`<?xml version="1.0" encoding="utf-8"?>\n<testsuite name="htmllint" tests="${filesArray.length}" failures="0" errors="${results.length}">`);

for (const file of filesArray) {
const errors = files[file];

for (const [file, errors] of filesArray) {
out.push(`<testcase name="${file}">\n<error message="${errors.length} Errors">`);

for (const [i, error] of errors.entries()) {
Expand Down

0 comments on commit 88ceebd

Please sign in to comment.