Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 19 additions & 43 deletions .dev-tools/src/Readme/ReadmeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
),
]);
}
Expand All @@ -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(
Expand Down
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
19 changes: 0 additions & 19 deletions tests/Readme/ReadmeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading