public static void Report(string assemblyPath, string outPath, Error[] errors, int numRules, TimeSpan totalTime) { TextWriter stream = outPath == "stdout" ? Console.Out : new StreamWriter(outPath); string assemblyFile = HtmlHelpers.Escape(Path.GetFileName(assemblyPath)); DoWriteHeader(stream, assemblyFile); stream.WriteLine("<body>"); stream.WriteLine("<h1 class = \"heading\">{0} Violations</h1>", assemblyFile); if (errors.Length == 0) { stream.WriteLine("<p>No errors.</p>"); } else { int counter = 1; Violations violations = ReportHelpers.GetViolations(errors); DoWriteViolations(stream, Severity.Error, violations, ref counter); DoWriteViolations(stream, Severity.Warning, violations, ref counter); DoWriteViolations(stream, Severity.Nitpick, violations, ref counter); DoWriteSummary(stream, errors, numRules, totalTime); } stream.WriteLine("</body>"); DoWriteTrailer(stream); stream.Flush(); }
public static void Report(string assemblyPath, string outPath, Error[] errors, int numRules, TimeSpan totalTime) { if (ms_consoleWidth == 0) { ms_consoleWidth = Settings.Get("consoleWidth", 80); } Profile.Start("Report"); Log.InfoLine(true, "generating a text report for {0} violations", errors.Length); TextWriter writer = outPath == "stdout" ? Console.Out : new StreamWriter(outPath); writer.WriteLine("Smokey '{0}' report:", assemblyPath); writer.WriteLine(" "); if (errors.Length == 0) { writer.WriteLine("no errors"); } else { int counter = 1; Violations violations = ReportHelpers.GetViolations(errors); DoWriteViolations(writer, Severity.Error, violations, ref counter); DoWriteViolations(writer, Severity.Warning, violations, ref counter); DoWriteViolations(writer, Severity.Nitpick, violations, ref counter); DoSummary(writer, errors, numRules, totalTime); } writer.Flush(); Profile.Stop("Report"); }