Skip to content

Commit

Permalink
#699 Rounding crap score to full number
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Oct 22, 2024
1 parent cd503fb commit 2dd7e8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ For further details take a look at LICENSE.txt.

CHANGELOG

5.3.10.0
5.3.12.0

* Fix: #699 Rounding crap score to full number

5.3.11.0

* New: Update dependencies (CVE-2024-43485)

Expand Down
2 changes: 1 addition & 1 deletion src/ReportGenerator.Core/Parser/CoberturaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private static void SetMethodMetrics(CodeFile codeFile, IEnumerable<XElement> me
var uncoveredPercent = (100f - (double)coveragePercent.Value) / 100.0;
var complexity = (double)cyclomaticComplexity.Value;
var crapScore = (Math.Pow(complexity, 2.0) * Math.Pow(uncoveredPercent, 3)) + complexity;
crapScore = Math.Round(crapScore, 2, MidpointRounding.AwayFromZero);
crapScore = Math.Round(crapScore, 0, MidpointRounding.AwayFromZero);

metrics.Insert(0, Metric.CrapScore((decimal)crapScore));
}
Expand Down

0 comments on commit 2dd7e8c

Please sign in to comment.