Skip to content

Commit

Permalink
Increase precision to 2 digits (2.3% => 2.34%)
Browse files Browse the repository at this point in the history
2 numbers makes a difference for large code base
(Usefull in Gitlab where you can check coverage before validating a Merge Request)
  • Loading branch information
tomap authored Dec 10, 2024
1 parent 537c17c commit 9e9bee8
Showing 1 changed file with 3 additions and 3 deletions.
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("f2", 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("f2", 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("f2", CultureInfo.InvariantCulture) + "%" : string.Empty;
reportTextWriter.WriteLine(
" {0}{1} {2}",
@class.DisplayName,
Expand Down

0 comments on commit 9e9bee8

Please sign in to comment.