From ec08a0c1bb39efb5500ff0c1316b0ff6335e6f6c Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 28 Oct 2016 08:17:26 +0200 Subject: [PATCH] removed old coverage-checker (#254) --- build/.gitignore | 3 -- build/coverage-checker.php | 60 -------------------------------------- 2 files changed, 63 deletions(-) delete mode 100644 build/.gitignore delete mode 100644 build/coverage-checker.php diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index 0a12060e..00000000 --- a/build/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.gitignore -!coverage-checker.php diff --git a/build/coverage-checker.php b/build/coverage-checker.php deleted file mode 100644 index 10e05fb9..00000000 --- a/build/coverage-checker.php +++ /dev/null @@ -1,60 +0,0 @@ -. - */ - -/** - * Code coverage checker. Analyzes a given `clover.xml` report produced - * by PHPUnit and checks if coverage fits expected ratio - * - * Usage: - * php coverage-checker - * - * @author Marco Pivetta - */ - -$inputFile = $argv[1]; -$percentage = min(100, max(0, (int) $argv[2])); - -if (!file_exists($inputFile)) { - throw new InvalidArgumentException('Invalid input file provided'); -} - -if (!$percentage) { - throw new InvalidArgumentException('An integer checked percentage must be given as second parameter'); -} - -$xml = new SimpleXMLElement(file_get_contents($inputFile)); -/* @var $metrics SimpleXMLElement[] */ -$metrics = $xml->xpath('//metrics'); - -$totalElements = 0; -$checkedElements = 0; - -foreach ($metrics as $metric) { - $totalElements += (int) $metric['elements']; - $checkedElements += (int) $metric['coveredelements']; -} - -$coverage = round(($checkedElements / $totalElements) * 100); - -if ($coverage < $percentage) { - echo 'Code coverage is ' . $coverage . '%, which is below the accepted ' . $percentage . '%' . PHP_EOL; -} else{ - echo 'Code coverage is ' . $coverage . '% - OK!' . PHP_EOL; -} -