Skip to content

Commit

Permalink
Merge pull request #23 from jonnynews/fix/coverage
Browse files Browse the repository at this point in the history
Remove method calculation in coverage metrics
  • Loading branch information
m0hanraj authored Nov 1, 2024
2 parents 2d01b74 + 8e4af5f commit 3c14f5d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/BadgeComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,18 @@ private function processFile(string $inputFile): void

$totalConditionals = 0;
$totalStatements = 0;
$totalMethods = 0;
$coveredStatements = 0;
$coveredConditionals = 0;
$coveredMethods = 0;

foreach ($metrics as $metric) {
$totalConditionals += (int) $metric['conditionals'];
$coveredConditionals += (int) $metric['coveredconditionals'];
$totalStatements += (int) $metric['statements'];
$coveredStatements += (int) $metric['coveredstatements'];
$totalMethods += (int) $metric['methods'];
$coveredMethods += (int) $metric['coveredmethods'];
}

$totalElements = $totalConditionals + $totalStatements + $totalMethods;
$coveredElements = $coveredConditionals + $coveredStatements + $coveredMethods;
$totalElements = $totalConditionals + $totalStatements;
$coveredElements = $coveredConditionals + $coveredStatements;
$coverageRatio = $totalElements ? $coveredElements / $totalElements : 0;
$this->totalCoverage[] = (int) round($coverageRatio * 100);

Expand Down

0 comments on commit 3c14f5d

Please sign in to comment.