Skip to content

Commit

Permalink
#716 Increased precision of percentages in CsvSummary and TextSummary…
Browse files Browse the repository at this point in the history
… reports (contributed by @tomap)
  • Loading branch information
danielpalme committed Dec 21, 2024
2 parents e530e91 + 9e9bee8 commit e4757cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ CHANGELOG
5.4.2.0

* Fix: #700 Fixed handling of .netconfig files (sourceDirectories, reportTypes, plugins, assemblyFilters, etc.)
* Fix: #716 Increased precision of percentages in CsvSummary and TextSummary reports (contributed by @tomap)
* Fix: #719 Fixed badges in MarkdownAssembliesSummary report

5.4.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void CreateSummaryReport(SummaryResult summaryResult)
reportTextWriter.WriteLine(
"{0};{1}",
ReportResources.Coverage2,
summaryResult.CoverageQuota.HasValue ? summaryResult.CoverageQuota.Value.ToString("f1", CultureInfo.InvariantCulture) + "%" : string.Empty);
summaryResult.CoverageQuota.HasValue ? summaryResult.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "%" : string.Empty);
reportTextWriter.WriteLine(
"{0};{1}",
ReportResources.CoveredLines,
Expand All @@ -134,7 +134,7 @@ public void CreateSummaryReport(SummaryResult summaryResult)
reportTextWriter.WriteLine(
"{0};{1}",
assembly.Name,
assembly.CoverageQuota.HasValue ? assembly.CoverageQuota.Value.ToString("f1", CultureInfo.InvariantCulture) + "%" : string.Empty);
assembly.CoverageQuota.HasValue ? assembly.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "%" : string.Empty);

if (assembly.Classes.Any())
{
Expand All @@ -146,7 +146,7 @@ public void CreateSummaryReport(SummaryResult summaryResult)
reportTextWriter.WriteLine(
"{0};{1}",
@class.Name,
@class.CoverageQuota.HasValue ? @class.CoverageQuota.Value.ToString("f1", CultureInfo.InvariantCulture) + "%" : string.Empty);
@class.CoverageQuota.HasValue ? @class.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "%" : string.Empty);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void CreateSummaryReport(SummaryResult summaryResult)
reportTextWriter.WriteLine(" {0} {1}", ReportResources.Assemblies2, assembliesWithClasses.Count().ToString(CultureInfo.InvariantCulture));
reportTextWriter.WriteLine(" {0} {1}", ReportResources.Classes, assembliesWithClasses.SelectMany(a => a.Classes).Count().ToString(CultureInfo.InvariantCulture));
reportTextWriter.WriteLine(" {0} {1}", ReportResources.Files2, assembliesWithClasses.SelectMany(a => a.Classes).SelectMany(a => a.Files).Distinct().Count().ToString(CultureInfo.InvariantCulture));
reportTextWriter.WriteLine(" {0} {1}", ReportResources.Coverage2, summaryResult.CoverageQuota.HasValue ? summaryResult.CoverageQuota.Value.ToString("f1", CultureInfo.InvariantCulture) + "%" : string.Empty);
reportTextWriter.WriteLine(" {0} {1}", ReportResources.Coverage2, summaryResult.CoverageQuota.HasValue ? summaryResult.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "%" : string.Empty);
reportTextWriter.WriteLine(" {0} {1}", ReportResources.CoveredLines, summaryResult.CoveredLines.ToString(CultureInfo.InvariantCulture));
reportTextWriter.WriteLine(" {0} {1}", ReportResources.UncoveredLines, (summaryResult.CoverableLines - summaryResult.CoveredLines).ToString(CultureInfo.InvariantCulture));
reportTextWriter.WriteLine(" {0} {1}", ReportResources.CoverableLines, summaryResult.CoverableLines.ToString(CultureInfo.InvariantCulture));
Expand Down Expand Up @@ -146,7 +146,7 @@ public void CreateSummaryReport(SummaryResult summaryResult)

foreach (var assembly in assembliesWithClasses)
{
string assemblyQuota = assembly.CoverageQuota.HasValue ? assembly.CoverageQuota.Value.ToString("f1", CultureInfo.InvariantCulture) + "%" : string.Empty;
string assemblyQuota = assembly.CoverageQuota.HasValue ? assembly.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "%" : string.Empty;
reportTextWriter.WriteLine();
reportTextWriter.WriteLine(
"{0}{1} {2}",
Expand All @@ -156,7 +156,7 @@ public void CreateSummaryReport(SummaryResult summaryResult)

foreach (var @class in assembly.Classes)
{
string classQuota = @class.CoverageQuota.HasValue ? @class.CoverageQuota.Value.ToString("f1", CultureInfo.InvariantCulture) + "%" : string.Empty;
string classQuota = @class.CoverageQuota.HasValue ? @class.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "%" : string.Empty;
reportTextWriter.WriteLine(
" {0}{1} {2}",
@class.DisplayName,
Expand Down

0 comments on commit e4757cc

Please sign in to comment.