Skip to content

Commit

Permalink
for some reason, the current way of reporting does not output everyth…
Browse files Browse the repository at this point in the history
…ing it should. Fixes #36
  • Loading branch information
fabiomcosta committed Sep 1, 2011
1 parent 49db77b commit f618180
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/reporters/jslint_xml.js
Expand Up @@ -5,10 +5,9 @@ module.exports =
reporter: function (results)
{
"use strict";
console.log("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
console.log("<jslint>");

var files = {},
out = [],
pairs = {
"&": "&amp;",
'"': "&quot;",
Expand All @@ -27,6 +26,7 @@ module.exports =
return s || "";
}


results.forEach(function (result) {
result.file = result.file.replace(/^\.\//, '');
if (!files[result.file]) {
Expand All @@ -35,15 +35,20 @@ module.exports =
files[result.file].push(result.error);
});

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

for (file in files) {
console.log("\t<file name=\"%s\">", file);
out.push("\t<file name=\""+ file +"\">");
for (i = 0; i < files[file].length; i++) {
issue = files[file][i];
console.log("\t\t<issue line=\"%d\" char=\"%d\" reason=\"%s\" evidence=\"%s\" />", issue.line, issue.character, encode(issue.reason), encode(issue.evidence));
out.push("\t\t<issue line=\""+ issue.line +"\" char=\""+ issue.character +"\" reason=\""+ encode(issue.reason) +"\" evidence=\""+ encode(issue.evidence) +"\" />");
}
console.log("\t</file>");
out.push("\t</file>");
}
console.log("</jslint>");
out.push("</jslint>");

console.log(out.join("\n"));

process.exit(results.length > 0 ? 1 : 0);
}
Expand Down

0 comments on commit f618180

Please sign in to comment.