/** * @fileoverview CheckStyle XML reporter * @author Ian Christian Myers */ "use strict"; //------------------------------------------------------------------------------ // Helper Functions //------------------------------------------------------------------------------ /** * Returns the severity of warning or error * @param {object} message message object to examine * @returns {string} severity level * @private */ function getMessageType(message) { if (message.fatal || message.severity === 2) { return "error"; } else { return "warning"; } } /** * Returns the escaped value for a character * @param {string} s string to examine * @returns {string} severity level * @private */ function xmlEscape(s) { return ("" + s).replace(/[<>&"']/g, function(c) { switch (c) { case "<": return "<"; case ">": return ">"; case "&": return "&"; case "\"": return """; case "'": return "'"; default: throw new Error("unreachable"); } }); } //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ module.exports = function(results) { var output = ""; output += ""; output += ""; results.forEach(function(result) { var messages = result.messages; output += ""; messages.forEach(function(message) { output += ""; }); output += ""; }); output += ""; return output; };