Skip to content

Commit

Permalink
Cobertura: Improved parsing of metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Sep 8, 2021
1 parent 8dd6474 commit 632daac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ReportGenerator.Core/Parser/CoberturaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private static void SetMethodMetrics(CodeFile codeFile, IEnumerable<XElement> me

if (!"NaN".Equals(lineRate.Value, StringComparison.OrdinalIgnoreCase))
{
value = Math.Round(100 * decimal.Parse(lineRate.Value, NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), 2, MidpointRounding.AwayFromZero);
value = Math.Round(100 * decimal.Parse(lineRate.Value.Replace(',', '.'), NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), 2, MidpointRounding.AwayFromZero);
}

metrics.Add(new Metric(
Expand All @@ -282,7 +282,7 @@ private static void SetMethodMetrics(CodeFile codeFile, IEnumerable<XElement> me

if (!"NaN".Equals(branchRate.Value, StringComparison.OrdinalIgnoreCase))
{
value = Math.Round(100 * decimal.Parse(branchRate.Value, NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), 2, MidpointRounding.AwayFromZero);
value = Math.Round(100 * decimal.Parse(branchRate.Value.Replace(',', '.'), NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), 2, MidpointRounding.AwayFromZero);
}

metrics.Add(new Metric(
Expand All @@ -300,7 +300,7 @@ private static void SetMethodMetrics(CodeFile codeFile, IEnumerable<XElement> me

if (!"NaN".Equals(cyclomaticComplexityAttribute.Value, StringComparison.OrdinalIgnoreCase))
{
value = Math.Round(decimal.Parse(cyclomaticComplexityAttribute.Value, NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), 2, MidpointRounding.AwayFromZero);
value = Math.Round(decimal.Parse(cyclomaticComplexityAttribute.Value.Replace(',', '.'), NumberStyles.Number | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), 2, MidpointRounding.AwayFromZero);
}

metrics.Insert(
Expand Down

0 comments on commit 632daac

Please sign in to comment.