From b4bf8d3e4b16cbfe9cb60f0501500d376001ef08 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 30 Aug 2021 14:09:57 +0200 Subject: [PATCH 1/6] Improve example (#25) --- docs/examples.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/examples.md b/docs/examples.md index 4c2e2a9..ea9f76c 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -36,7 +36,7 @@ Task("Create-IssueReport").Does(() => ); MSBuild(repoRootFolder.CombineWithFilePath("MySolution.sln"), settings); - // Create SARIF report. + // Write issues to console. CreateIssueReport( new List { @@ -44,8 +44,14 @@ Task("Create-IssueReport").Does(() => msBuildLogFile, MsBuildXmlFileLoggerFormat) }, - ConsoleIssueReportFormat(), + ConsoleIssueReportFormat( + new ConsoleIssueReportFormatSettings + { + GroupByRule = true, + ShowProviderSummary = true, + ShowPrioritySummary = true + }), repoRootFolder, string.Empty); }); -``` \ No newline at end of file +``` From 6c9ec34de80529a614e242600df7f56461205a63 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 30 Aug 2021 21:17:41 +0200 Subject: [PATCH 2/6] (GH-21) Fix repository link (#26) --- nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec | 2 +- nuspec/nuget/Cake.Issues.Reporting.Console.nuspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec index 1273b60..1478a14 100644 --- a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec @@ -25,7 +25,7 @@ The addin requires Cake Frosting 1.2.0 or higher running on .NET 5.0 or higher. https://cakeissues.net icon.png false - + Copyright © Pascal Berger cake cake-addin cake-issues cake-reportformat issues reporting console https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0 diff --git a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec index 66bcc7e..c0bf408 100644 --- a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec @@ -25,7 +25,7 @@ The addin requires Cake .NET Tool 1.2.0 or higher running on .NET 5.0 or higher. https://cakeissues.net icon.png false - + Copyright © Pascal Berger cake cake-addin cake-issues cake-reportformat issues reporting console https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0 From 276e463d77a96f9e36ebb30d23cb3dc5df342946 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 30 Aug 2021 21:19:18 +0200 Subject: [PATCH 3/6] (GH-23) Fix ShowPrioritySummary setting (#27) --- .../ConsoleIssueReportGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs index 4cc996d..1f19ca8 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -139,7 +139,7 @@ private void PrintSummary(IEnumerable issues) AnsiConsole.WriteLine(); } - if (this.consoleIssueReportFormatSettings.ShowProviderSummary) + if (this.consoleIssueReportFormatSettings.ShowPrioritySummary) { AnsiConsole.Render(new Markup("[bold]Issues per priority[/]").Centered()); AnsiConsole.WriteLine(); From 29f2a8702af4f5ca70a77118d5607d2100f5c453 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 30 Aug 2021 21:40:19 +0200 Subject: [PATCH 4/6] (GH-22) Add setting to toggle diagnostics (#28) --- .../ConsoleIssueReportFormatSettings.cs | 6 +++ .../ConsoleIssueReportGenerator.cs | 47 ++++++++++--------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs index 2fbad5d..71fd509 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs @@ -5,6 +5,12 @@ /// public class ConsoleIssueReportFormatSettings { + /// + /// Gets or sets a value indicating whether diagnostics for the individual issues should be shown. + /// Default value is true. + /// + public bool ShowDiagnostics { get; set; } = true; + /// /// Gets or sets a value indicating whether issues should be grouped by rule or if /// for every issue a separate diagnostic should be created. diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs index 1f19ca8..b98b9e1 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -31,41 +31,44 @@ public ConsoleIssueReportGenerator(ICakeLog log, ConsoleIssueReportFormatSetting /// protected override FilePath InternalCreateReport(IEnumerable issues) { - // Filter to issues from existing files - var diagnosticIssues = + if (this.consoleIssueReportFormatSettings.ShowProviderSummary) + { + // Filter to issues from existing files + var diagnosticIssues = issues .Where(x => x.AffectedFileRelativePath != null && File.Exists(this.Settings.RepositoryRoot.CombineWithFilePath(x.AffectedFileRelativePath).FullPath)) .ToList(); - // Filter to issues with line and column information - // Errata currently doesn't support file or line level diagnostics. - // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/4 - // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/5 - diagnosticIssues = - diagnosticIssues - .Where(x => x.Line.HasValue && x.Column.HasValue) - .ToList(); + // Filter to issues with line and column information + // Errata currently doesn't support file or line level diagnostics. + // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/4 + // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/5 + diagnosticIssues = + diagnosticIssues + .Where(x => x.Line.HasValue && x.Column.HasValue) + .ToList(); - var report = new Report(new FileSystemRepository(this.Settings)); + var report = new Report(new FileSystemRepository(this.Settings)); - if (this.consoleIssueReportFormatSettings.GroupByRule) - { - foreach (var issueGroup in diagnosticIssues.GroupBy(x => x.Rule)) + if (this.consoleIssueReportFormatSettings.GroupByRule) { - report.AddDiagnostic(new IssueDiagnostic(issueGroup)); + foreach (var issueGroup in diagnosticIssues.GroupBy(x => x.Rule)) + { + report.AddDiagnostic(new IssueDiagnostic(issueGroup)); + } } - } - else - { - foreach (var issue in diagnosticIssues) + else { - report.AddDiagnostic(new IssueDiagnostic(issue)); + foreach (var issue in diagnosticIssues) + { + report.AddDiagnostic(new IssueDiagnostic(issue)); + } } - } - report.Render(AnsiConsole.Console); + report.Render(AnsiConsole.Console); + } if (this.consoleIssueReportFormatSettings.ShowProviderSummary || this.consoleIssueReportFormatSettings.ShowPrioritySummary) { From 41b3efb6cbc497b239a3bb46fd313f53f2e71eee Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 30 Aug 2021 21:55:46 +0200 Subject: [PATCH 5/6] (GH-24) Add setting for compact mode (#29) --- .../ConsoleIssueReportFormatSettings.cs | 6 ++++++ .../ConsoleIssueReportGenerator.cs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs index 71fd509..35d4c47 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs @@ -11,6 +11,12 @@ public class ConsoleIssueReportFormatSettings /// public bool ShowDiagnostics { get; set; } = true; + /// + /// Gets or sets a value indicating whether or not the report should be rendered in compact mode. + /// Default value is false. + /// + public bool Compact { get; set; } + /// /// Gets or sets a value indicating whether issues should be grouped by rule or if /// for every issue a separate diagnostic should be created. diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs index b98b9e1..1b49f5b 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -67,7 +67,12 @@ protected override FilePath InternalCreateReport(IEnumerable issues) } } - report.Render(AnsiConsole.Console); + report.Render( + AnsiConsole.Console, + new ReportSettings + { + Compact = this.consoleIssueReportFormatSettings.Compact, + }); } if (this.consoleIssueReportFormatSettings.ShowProviderSummary || this.consoleIssueReportFormatSettings.ShowPrioritySummary) From 68add24bf69f1a009d05c8f3149ee2167efc5cfc Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 30 Aug 2021 22:01:55 +0200 Subject: [PATCH 6/6] Update release notes link --- nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec | 2 +- nuspec/nuget/Cake.Issues.Reporting.Console.nuspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec index 1478a14..edcabfc 100644 --- a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec @@ -28,7 +28,7 @@ The addin requires Cake Frosting 1.2.0 or higher running on .NET 5.0 or higher. Copyright © Pascal Berger cake cake-addin cake-issues cake-reportformat issues reporting console - https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0 + https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.2.0 diff --git a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec index c0bf408..4915bdc 100644 --- a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec @@ -28,7 +28,7 @@ The addin requires Cake .NET Tool 1.2.0 or higher running on .NET 5.0 or higher. Copyright © Pascal Berger cake cake-addin cake-issues cake-reportformat issues reporting console - https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0 + https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.2.0