| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/2798582/cwd/scripts/analysis/ |
Upload File : |
<?php
// Analyze coverage gaps from clover XML
$xml = simplexml_load_file(__DIR__.'/../tests/.coverage/clover.xml');
$gap1 = [];
$gap2 = [];
foreach ($xml->project->package as $pkg) {
foreach ($pkg->file as $file) {
foreach ($file->class as $class) {
$m = $class->metrics;
$methods = (int) $m['methods'];
$covered = (int) $m['coveredmethods'];
if ($methods == 0) {
continue;
}
$uncov = $methods - $covered;
$lines = (int) $m['statements'];
$covLines = (int) $m['coveredstatements'];
$uncovLines = $lines - $covLines;
$entry = [
'class' => (string) $class['name'],
'file' => (string) $file['name'],
'methods' => $methods,
'covered_methods' => $covered,
'uncov_lines' => $uncovLines,
];
if ($uncov == 1) {
$gap1[] = $entry;
} elseif ($uncov == 2) {
$gap2[] = $entry;
}
}
}
}
usort($gap1, fn ($a, $b) => $b['uncov_lines'] - $a['uncov_lines']);
usort($gap2, fn ($a, $b) => $b['uncov_lines'] - $a['uncov_lines']);
echo "=== GAP-1 CLASSES (need 1 method) ===\n";
foreach ($gap1 as $i => $item) {
printf("%d. %s (%d uncov lines) - %s\n", $i + 1, $item['class'], $item['uncov_lines'], $item['file']);
}
echo "\nTotal gap-1: ".count($gap1)."\n\n";
echo "=== GAP-2 CLASSES (need 2 methods) ===\n";
foreach ($gap2 as $i => $item) {
printf("%d. %s (%d uncov lines) - %s\n", $i + 1, $item['class'], $item['uncov_lines'], $item['file']);
}
echo "\nTotal gap-2: ".count($gap2)."\n";