From 8e4af5f02d14b6accfffa112381c722078a2e3af Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Fri, 1 Nov 2024 14:30:29 +0000 Subject: [PATCH] Remove method calculation in coverage metrics This commit simplifies the coverage metrics calculation by eliminating the counting of method-specific metrics. The focus is now solely on conditionals and statements, ensuring more streamlined and potentially faster processing. --- src/BadgeComposer.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/BadgeComposer.php b/src/BadgeComposer.php index ddec43b..3a01e8b 100644 --- a/src/BadgeComposer.php +++ b/src/BadgeComposer.php @@ -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);