main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * @fileoverview JSLint XML reporter
|
---|
| 3 | * @author Ian Christian Myers
|
---|
| 4 | */
|
---|
| 5 | "use strict";
|
---|
| 6 |
|
---|
| 7 | const xmlEscape = require("../xml-escape");
|
---|
| 8 |
|
---|
| 9 | //------------------------------------------------------------------------------
|
---|
| 10 | // Public Interface
|
---|
| 11 | //------------------------------------------------------------------------------
|
---|
| 12 |
|
---|
| 13 | module.exports = function(results) {
|
---|
| 14 |
|
---|
| 15 | let output = "";
|
---|
| 16 |
|
---|
| 17 | output += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
|
---|
| 18 | output += "<jslint>";
|
---|
| 19 |
|
---|
| 20 | results.forEach(result => {
|
---|
| 21 | const messages = result.messages;
|
---|
| 22 |
|
---|
| 23 | output += `<file name="${result.filePath}">`;
|
---|
| 24 |
|
---|
| 25 | messages.forEach(message => {
|
---|
| 26 | output += [
|
---|
| 27 | `<issue line="${message.line}"`,
|
---|
| 28 | `char="${message.column}"`,
|
---|
| 29 | `evidence="${xmlEscape(message.source || "")}"`,
|
---|
| 30 | `reason="${xmlEscape(message.message || "")}${message.ruleId ? ` (${message.ruleId})` : ""}" />`
|
---|
| 31 | ].join(" ");
|
---|
| 32 | });
|
---|
| 33 |
|
---|
| 34 | output += "</file>";
|
---|
| 35 |
|
---|
| 36 | });
|
---|
| 37 |
|
---|
| 38 | output += "</jslint>";
|
---|
| 39 |
|
---|
| 40 | return output;
|
---|
| 41 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.