diff --git a/.dev-tools/src/Readme/ReadmeCommand.php b/.dev-tools/src/Readme/ReadmeCommand.php index 27d2bc02..08cd5021 100644 --- a/.dev-tools/src/Readme/ReadmeCommand.php +++ b/.dev-tools/src/Readme/ReadmeCommand.php @@ -27,7 +27,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Process\Process; /** * @internal @@ -60,52 +59,37 @@ private static function badges(): string { return \implode("\n", [ self::badge( - 'Latest stable version', - \sprintf('%s/packagist/v/%s.svg?label=current%%20version', self::SHIELDS_HOST, self::composer()->name), - \sprintf('https://packagist.org/packages/%s', self::composer()->name), - ), - self::badge( - 'PHP version', - \sprintf('%s/packagist/php-v/%s.svg', self::SHIELDS_HOST, self::composer()->name), - 'https://php.net', - ), - self::badge( - 'License', - \sprintf('%s/github/license/%s.svg', self::SHIELDS_HOST, self::composer()->name), - 'LICENSE', - ), - self::badge( - 'Tests', - \sprintf('%s/badge/tests-%d-brightgreen.svg', self::SHIELDS_HOST, self::numberOfTests()), - ), - self::badge( - 'Downloads', - \sprintf('%s/packagist/dt/%s.svg', self::SHIELDS_HOST, self::composer()->name), - \sprintf('https://packagist.org/packages/%s', self::composer()->name), - ), - '', - self::badge( - 'CI status', - \sprintf('https://github.com/%s/actions/workflows/ci.yaml/badge.svg', self::composer()->name), + 'CI', + \sprintf('%s/github/actions/workflow/status/%s/ci.yaml?label=CI', self::SHIELDS_HOST, self::composer()->name), \sprintf('https://github.com/%s/actions/workflows/ci.yaml', self::composer()->name), ), self::badge( - 'Code coverage', - \sprintf('%s/coveralls/github/%s/main.svg', self::SHIELDS_HOST, self::composer()->name), + 'Test coverage', + \sprintf('%s/coverallsCoverage/github/%s.svg?branch=main&label=Test%%20coverage', self::SHIELDS_HOST, self::composer()->name), \sprintf('https://coveralls.io/github/%s?branch=main', self::composer()->name), ), self::badge( - 'Mutation testing badge', + 'Type coverage', \sprintf( - 'https://img.shields.io/endpoint?style=flat&url=%s', + '%s/endpoint?label=Type%%20coverage&url=%s', + self::SHIELDS_HOST, + \rawurlencode('https://shepherd.dev/views/coverage_data.php?' . self::composer()->name), + ), + \sprintf('https://shepherd.dev/github/%s', self::composer()->name), + ), + self::badge( + 'Mutation Score Indicator', + \sprintf( + '%s/endpoint?label=Mutation%%20Score%%20Indicator&logo=none&url=%s', + self::SHIELDS_HOST, \rawurlencode(\sprintf('https://badge-api.stryker-mutator.io/github.com/%s/main', self::composer()->name)), ), \sprintf('https://dashboard.stryker-mutator.io/reports/github.com/%s/main', self::composer()->name), ), self::badge( - 'Psalm type coverage', - \sprintf('https://shepherd.dev/github/%s/coverage.svg', self::composer()->name), - \sprintf('https://shepherd.dev/github/%s', self::composer()->name), + 'Downloads', + \sprintf('%s/packagist/dt/%s.svg?label=Downloads', self::SHIELDS_HOST, self::composer()->name), + \sprintf('https://packagist.org/packages/%s/stats', self::composer()->name), ), ]); } @@ -121,14 +105,6 @@ private static function badge(string $description, string $imageUrl, ?string $ta return $badge; } - private static function numberOfTests(): int - { - $process = new Process([__DIR__ . '/../../../vendor/bin/phpunit', '--list-tests'], __DIR__ . '/../../..'); - $process->run(); - - return \substr_count($process->getOutput(), \PHP_EOL) - 3; // 3 is for header - } - private static function description(): string { return \str_replace( diff --git a/README.md b/README.md index 3f5633d8..0deb922c 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,11 @@ # PHP CS Fixer: custom fixers -[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers) -[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net) -[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE) -![Tests](https://img.shields.io/badge/tests-3805-brightgreen.svg) -[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers) - -[![CI status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml/badge.svg)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml) -[![Code coverage](https://img.shields.io/coveralls/github/kubawerlos/php-cs-fixer-custom-fixers/main.svg)](https://coveralls.io/github/kubawerlos/php-cs-fixer-custom-fixers?branch=main) -[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fkubawerlos%2Fphp-cs-fixer-custom-fixers%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/kubawerlos/php-cs-fixer-custom-fixers/main) -[![Psalm type coverage](https://shepherd.dev/github/kubawerlos/php-cs-fixer-custom-fixers/coverage.svg)](https://shepherd.dev/github/kubawerlos/php-cs-fixer-custom-fixers) +[![CI](https://img.shields.io/github/actions/workflow/status/kubawerlos/php-cs-fixer-custom-fixers/ci.yaml?label=CI)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml) +[![Test coverage](https://img.shields.io/coverallsCoverage/github/kubawerlos/php-cs-fixer-custom-fixers.svg?branch=main&label=Test%20coverage)](https://coveralls.io/github/kubawerlos/php-cs-fixer-custom-fixers?branch=main) +[![Type coverage](https://img.shields.io/endpoint?label=Type%20coverage&url=https%3A%2F%2Fshepherd.dev%2Fviews%2Fcoverage_data.php%3Fkubawerlos%2Fphp-cs-fixer-custom-fixers)](https://shepherd.dev/github/kubawerlos/php-cs-fixer-custom-fixers) +[![Mutation Score Indicator](https://img.shields.io/endpoint?label=Mutation%20Score%20Indicator&logo=none&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fkubawerlos%2Fphp-cs-fixer-custom-fixers%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/kubawerlos/php-cs-fixer-custom-fixers/main) +[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg?label=Downloads)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers/stats) A set of custom fixers for [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). diff --git a/tests/Readme/ReadmeCommandTest.php b/tests/Readme/ReadmeCommandTest.php index 87a27490..9e646ea3 100644 --- a/tests/Readme/ReadmeCommandTest.php +++ b/tests/Readme/ReadmeCommandTest.php @@ -37,23 +37,4 @@ public function testReadmeIsUpToDate(): void 'README.md is not up to date, run "composer fix" to update it.', ); } - - public function testNumberOfTests(): void - { - \preg_match( - '~https://img.shields.io/badge/tests-(\\d+)-brightgreen.svg~', - (string) \file_get_contents(__DIR__ . '/../../README.md'), - $matches, - ); - self::assertArrayHasKey(1, $matches); - - $expectedNumberOfTests = (int) $matches[1]; - - $readmeCommand = new \ReflectionClass(ReadmeCommand::class); - $numberOfTests = $readmeCommand->getMethod('numberOfTests'); - $numberOfTests->setAccessible(true); - $actualNumberOfTests = $numberOfTests->invoke($readmeCommand->newInstance()); - - self::assertSame($expectedNumberOfTests, $actualNumberOfTests); - } }