import Foundation public struct JUnitReporter: Reporter { public static let identifier = "junit" public static let isRealtime = false public var description: String { return "Reports violations as JUnit XML." } public static func generateReport(_ violations: [StyleViolation]) -> String { return "\n" + violations.map({ violation -> String in let fileName = (violation.location.file ?? "").escapedForXML() let severity = violation.severity.rawValue + ":\n" let message = severity + "Line:" + String(violation.location.line ?? 0) + " " let reason = violation.reason.escapedForXML() return ["\n\t\n", "" + message + "", "\t"].joined() }).joined() + "\n" } }