Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalise new -ReportSummary switch #895

Merged
merged 14 commits into from
Mar 2, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use built in warning/error methods to get colouring to work in a user…
… setting agnostic way
  • Loading branch information
bergmeister committed Feb 25, 2018
commit a15fc196052d0c02604f9ba22f550c93e79030fa
15 changes: 10 additions & 5 deletions Engine/Commands/InvokeScriptAnalyzerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,20 @@ private void WriteToOutput(IEnumerable<DiagnosticRecord> diagnosticRecords)
var numberOfRuleViolations = infoCount + warningCount + errorCount;
if (numberOfRuleViolations == 0)
{
Host.UI.WriteLine(foregroundColor: ConsoleColor.Green, backgroundColor: Host.UI.RawUI.BackgroundColor,
value: "0 rule violations found.");
Host.UI.WriteLine("0 rule violations found.");
}
else
{
var foregroundConsoleColor = warningCount + errorCount == 0 ? ConsoleColor.Yellow : ConsoleColor.Red;
var pluralS = numberOfRuleViolations > 1 ? "s" : string.Empty;
Host.UI.WriteLine(foregroundColor: foregroundConsoleColor, backgroundColor: Host.UI.RawUI.BackgroundColor,
value: $"{numberOfRuleViolations} rule violation{pluralS} found. Severity distribution: {DiagnosticSeverity.Error} = {errorCount}, {DiagnosticSeverity.Warning} = {warningCount}, {DiagnosticSeverity.Information} = {infoCount}");
var message = $"{numberOfRuleViolations} rule violation{pluralS} found. Severity distribution: {DiagnosticSeverity.Error} = {errorCount}, {DiagnosticSeverity.Warning} = {warningCount}, {DiagnosticSeverity.Information} = {infoCount}";
if (warningCount + errorCount == 0)
{
Host.UI.WriteWarningLine(message);
}
else
{
Host.UI.WriteErrorLine(message);
}
}
}
}
Expand Down