All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jshint-2.4.3.node_modules.jshint.src.reporters.jslint_xml.js Maven / Gradle / Ivy

The newest version!
module.exports =
{
  reporter: function (results)
  {
    "use strict";

    var files = {},
    out = [],
    pairs = {
      "&": "&",
      '"': """,
      "'": "'",
      "<": "<",
      ">": ">"
    },
    file, i, issue;

    function encode(s) {
      for (var r in pairs) {
        if (typeof(s) !== "undefined") {
          s = s.replace(new RegExp(r, "g"), pairs[r]);
        }
      }
      return s || "";
    }


    results.forEach(function (result) {
      result.file = result.file.replace(/^\.\//, '');
      if (!files[result.file]) {
        files[result.file] = [];
      }
      files[result.file].push(result.error);
    });

    out.push("");
    out.push("");

    for (file in files) {
      out.push("\t");
      for (i = 0; i < files[file].length; i++) {
        issue = files[file][i];
        out.push("\t\t");
      }
      out.push("\t");
    }

    out.push("");

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy