exussum12 /
coverageChecker
| 1 | <?php |
||||||
| 2 | namespace exussum12\CoverageChecker\Runners; |
||||||
| 3 | |||||||
| 4 | use exussum12\CoverageChecker; |
||||||
| 5 | use exussum12\CoverageChecker\Exceptions\ArgumentNotFound; |
||||||
| 6 | use exussum12\CoverageChecker\Outputs\Json; |
||||||
| 7 | use exussum12\CoverageChecker\Outputs\Phpcs; |
||||||
| 8 | use exussum12\CoverageChecker\Outputs\Text; |
||||||
| 9 | |||||||
| 10 | require_once __DIR__ . "/../functions.php"; |
||||||
| 11 | global $argv; |
||||||
| 12 | |||||||
| 13 | CoverageChecker\addExceptionHandler(); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 14 | CoverageChecker\findAutoLoader(); |
||||||
|
0 ignored issues
–
show
The function
findAutoLoader was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 15 | $args = new CoverageChecker\ArgParser($argv); |
||||||
| 16 | CoverageChecker\checkForVersion($args); |
||||||
|
0 ignored issues
–
show
The function
checkForVersion was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 17 | CoverageChecker\checkCallIsCorrect($args); |
||||||
|
0 ignored issues
–
show
The function
checkCallIsCorrect was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 18 | |||||||
| 19 | try { |
||||||
| 20 | $minimumPercentCovered = CoverageChecker\getMinPercent($args->getArg('3')); |
||||||
|
0 ignored issues
–
show
The function
getMinPercent was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 21 | } catch (ArgumentNotFound $exception) { |
||||||
| 22 | $minimumPercentCovered = 100; |
||||||
| 23 | } |
||||||
| 24 | |||||||
| 25 | $matcher = new CoverageChecker\FileMatchers\EndsWith(); |
||||||
| 26 | |||||||
| 27 | $diff = new CoverageChecker\DiffFileLoader( |
||||||
| 28 | CoverageChecker\adjustForStdIn($args->getArg('1')) |
||||||
|
0 ignored issues
–
show
The function
adjustForStdIn was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 29 | ); |
||||||
| 30 | |||||||
| 31 | try { |
||||||
| 32 | $autoload = $args->getArg('autoload'); |
||||||
| 33 | if (file_exists(($autoload))) { |
||||||
| 34 | require_once $autoload; |
||||||
| 35 | } |
||||||
| 36 | } catch (ArgumentNotFound $exception) { |
||||||
| 37 | // do nothing, its not a required argument |
||||||
| 38 | } |
||||||
| 39 | |||||||
| 40 | $checkerArray = [ |
||||||
| 41 | 'buddy' => 'Buddy', |
||||||
| 42 | 'checkstyle' => 'Checkstyle', |
||||||
| 43 | 'clover' => 'Clover', |
||||||
| 44 | 'codeclimate' => 'CodeClimate', |
||||||
| 45 | 'humbug' => 'Humbug', |
||||||
| 46 | 'infecton' => 'Infection', |
||||||
| 47 | 'jacoco' => 'Jacoco', |
||||||
| 48 | 'phan' => 'PhanText', |
||||||
| 49 | 'phanJson' => 'PhanJson', |
||||||
| 50 | 'phpcpd' => 'Phpcpd', |
||||||
| 51 | 'phpcs' => 'PhpCs', |
||||||
| 52 | 'phpcsStrict' => 'PhpCsStrict', |
||||||
| 53 | 'phpmd' => 'PhpMd', |
||||||
| 54 | 'phpmdStrict' => 'PhpMdStrict', |
||||||
| 55 | 'phpmnd' => 'PhpMnd', |
||||||
| 56 | 'phpmndXml' => 'PhpMndXml', |
||||||
| 57 | 'phpstan' => 'PhpStan', |
||||||
| 58 | 'phpunit' => 'PhpUnit', |
||||||
| 59 | 'pylint' => 'Pylint', |
||||||
| 60 | 'psalm' => 'Psalm', |
||||||
| 61 | ]; |
||||||
| 62 | |||||||
| 63 | $fileCheck = CoverageChecker\getFileChecker( |
||||||
|
0 ignored issues
–
show
The function
getFileChecker was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 64 | $args, |
||||||
| 65 | $checkerArray, |
||||||
| 66 | CoverageChecker\adjustForStdIn($args->getArg('2')) |
||||||
| 67 | ); |
||||||
| 68 | |||||||
| 69 | $outputArray = [ |
||||||
| 70 | 'text' => Text::class, |
||||||
| 71 | 'json' => Json::class, |
||||||
| 72 | 'phpcs' => Phpcs::class, |
||||||
| 73 | ]; |
||||||
| 74 | try { |
||||||
| 75 | $report = $args->getArg('report'); |
||||||
| 76 | } catch (ArgumentNotFound $exception) { |
||||||
| 77 | $report = 'text'; |
||||||
| 78 | } |
||||||
| 79 | |||||||
| 80 | $report = new $outputArray[$report]; |
||||||
| 81 | |||||||
| 82 | $coverageCheck = new CoverageChecker\CoverageCheck($diff, $fileCheck, $matcher); |
||||||
| 83 | |||||||
| 84 | $lines = $coverageCheck->getCoveredLines(); |
||||||
| 85 | |||||||
| 86 | CoverageChecker\handleOutput($lines, $minimumPercentCovered, $report); |
||||||
|
0 ignored issues
–
show
The function
handleOutput was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 87 |