Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Aug 30, 2021
2 parents 89de1fd + 68add24 commit edda4b9
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 30 deletions.
12 changes: 9 additions & 3 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,22 @@ Task("Create-IssueReport").Does(() =>
);
MSBuild(repoRootFolder.CombineWithFilePath("MySolution.sln"), settings);

// Create SARIF report.
// Write issues to console.
CreateIssueReport(
new List<IIssueProvider>
{
MsBuildIssuesFromFilePath(
msBuildLogFile,
MsBuildXmlFileLoggerFormat)
},
ConsoleIssueReportFormat(),
ConsoleIssueReportFormat(
new ConsoleIssueReportFormatSettings
{
GroupByRule = true,
ShowProviderSummary = true,
ShowPrioritySummary = true
}),
repoRootFolder,
string.Empty);
});
```
```
4 changes: 2 additions & 2 deletions nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ The addin requires Cake Frosting 1.2.0 or higher running on .NET 5.0 or higher.
<projectUrl>https://cakeissues.net</projectUrl>
<icon>icon.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-contrib/Cake.Issues.Reporting.Generic.git"/>
<repository type="git" url="https://github.com/cake-contrib/Cake.Issues.Reporting.Console.git"/>
<copyright>Copyright © Pascal Berger</copyright>
<tags>cake cake-addin cake-issues cake-reportformat issues reporting console</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.2.0</releaseNotes>
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Cake.Core" version="[1.2,2.0)" exclude="Build,Analyzers" />
Expand Down
4 changes: 2 additions & 2 deletions nuspec/nuget/Cake.Issues.Reporting.Console.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ The addin requires Cake .NET Tool 1.2.0 or higher running on .NET 5.0 or higher.
<projectUrl>https://cakeissues.net</projectUrl>
<icon>icon.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-contrib/Cake.Issues.Reporting.Generic.git"/>
<repository type="git" url="https://github.com/cake-contrib/Cake.Issues.Reporting.Console.git"/>
<copyright>Copyright © Pascal Berger</copyright>
<tags>cake cake-addin cake-issues cake-reportformat issues reporting console</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.2.0</releaseNotes>
</metadata>
<files>
<file src="..\..\..\..\nuspec\nuget\icon.png" target="" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
/// </summary>
public class ConsoleIssueReportFormatSettings
{
/// <summary>
/// Gets or sets a value indicating whether diagnostics for the individual issues should be shown.
/// Default value is <c>true</c>.
/// </summary>
public bool ShowDiagnostics { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether or not the report should be rendered in compact mode.
/// Default value is <c>false</c>.
/// </summary>
public bool Compact { get; set; }

/// <summary>
/// Gets or sets a value indicating whether issues should be grouped by rule or if
/// for every issue a separate diagnostic should be created.
Expand Down
54 changes: 31 additions & 23 deletions src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,41 +31,49 @@ public ConsoleIssueReportGenerator(ICakeLog log, ConsoleIssueReportFormatSetting
/// <inheritdoc />
protected override FilePath InternalCreateReport(IEnumerable<IIssue> 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,
new ReportSettings
{
Compact = this.consoleIssueReportFormatSettings.Compact,
});
}

if (this.consoleIssueReportFormatSettings.ShowProviderSummary || this.consoleIssueReportFormatSettings.ShowPrioritySummary)
{
Expand Down Expand Up @@ -139,7 +147,7 @@ private void PrintSummary(IEnumerable<IIssue> issues)
AnsiConsole.WriteLine();
}

if (this.consoleIssueReportFormatSettings.ShowProviderSummary)
if (this.consoleIssueReportFormatSettings.ShowPrioritySummary)
{
AnsiConsole.Render(new Markup("[bold]Issues per priority[/]").Centered());
AnsiConsole.WriteLine();
Expand Down

0 comments on commit edda4b9

Please sign in to comment.