Skip to content

Commit 0763868

Browse files
authored
Update README.md badges (#1060)
1 parent 79e14df commit 0763868

File tree

3 files changed

+24
-72
lines changed

3 files changed

+24
-72
lines changed

.dev-tools/src/Readme/ReadmeCommand.php

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Symfony\Component\Console\Command\Command;
2828
use Symfony\Component\Console\Input\InputInterface;
2929
use Symfony\Component\Console\Output\OutputInterface;
30-
use Symfony\Component\Process\Process;
3130

3231
/**
3332
* @internal
@@ -60,52 +59,37 @@ private static function badges(): string
6059
{
6160
return \implode("\n", [
6261
self::badge(
63-
'Latest stable version',
64-
\sprintf('%s/packagist/v/%s.svg?label=current%%20version', self::SHIELDS_HOST, self::composer()->name),
65-
\sprintf('https://packagist.org/packages/%s', self::composer()->name),
66-
),
67-
self::badge(
68-
'PHP version',
69-
\sprintf('%s/packagist/php-v/%s.svg', self::SHIELDS_HOST, self::composer()->name),
70-
'https://php.net',
71-
),
72-
self::badge(
73-
'License',
74-
\sprintf('%s/github/license/%s.svg', self::SHIELDS_HOST, self::composer()->name),
75-
'LICENSE',
76-
),
77-
self::badge(
78-
'Tests',
79-
\sprintf('%s/badge/tests-%d-brightgreen.svg', self::SHIELDS_HOST, self::numberOfTests()),
80-
),
81-
self::badge(
82-
'Downloads',
83-
\sprintf('%s/packagist/dt/%s.svg', self::SHIELDS_HOST, self::composer()->name),
84-
\sprintf('https://packagist.org/packages/%s', self::composer()->name),
85-
),
86-
'',
87-
self::badge(
88-
'CI status',
89-
\sprintf('https://github.com/%s/actions/workflows/ci.yaml/badge.svg', self::composer()->name),
62+
'CI',
63+
\sprintf('%s/github/actions/workflow/status/%s/ci.yaml?label=CI', self::SHIELDS_HOST, self::composer()->name),
9064
\sprintf('https://github.com/%s/actions/workflows/ci.yaml', self::composer()->name),
9165
),
9266
self::badge(
93-
'Code coverage',
94-
\sprintf('%s/coveralls/github/%s/main.svg', self::SHIELDS_HOST, self::composer()->name),
67+
'Test coverage',
68+
\sprintf('%s/coverallsCoverage/github/%s.svg?branch=main&label=Test%%20coverage', self::SHIELDS_HOST, self::composer()->name),
9569
\sprintf('https://coveralls.io/github/%s?branch=main', self::composer()->name),
9670
),
9771
self::badge(
98-
'Mutation testing badge',
72+
'Type coverage',
9973
\sprintf(
100-
'https://img.shields.io/endpoint?style=flat&url=%s',
74+
'%s/endpoint?label=Type%%20coverage&url=%s',
75+
self::SHIELDS_HOST,
76+
\rawurlencode('https://shepherd.dev/views/coverage_data.php?' . self::composer()->name),
77+
),
78+
\sprintf('https://shepherd.dev/github/%s', self::composer()->name),
79+
),
80+
self::badge(
81+
'Mutation Score Indicator',
82+
\sprintf(
83+
'%s/endpoint?label=Mutation%%20Score%%20Indicator&logo=none&url=%s',
84+
self::SHIELDS_HOST,
10185
\rawurlencode(\sprintf('https://badge-api.stryker-mutator.io/github.com/%s/main', self::composer()->name)),
10286
),
10387
\sprintf('https://dashboard.stryker-mutator.io/reports/github.com/%s/main', self::composer()->name),
10488
),
10589
self::badge(
106-
'Psalm type coverage',
107-
\sprintf('https://shepherd.dev/github/%s/coverage.svg', self::composer()->name),
108-
\sprintf('https://shepherd.dev/github/%s', self::composer()->name),
90+
'Downloads',
91+
\sprintf('%s/packagist/dt/%s.svg?label=Downloads', self::SHIELDS_HOST, self::composer()->name),
92+
\sprintf('https://packagist.org/packages/%s/stats', self::composer()->name),
10993
),
11094
]);
11195
}
@@ -121,14 +105,6 @@ private static function badge(string $description, string $imageUrl, ?string $ta
121105
return $badge;
122106
}
123107

124-
private static function numberOfTests(): int
125-
{
126-
$process = new Process([__DIR__ . '/../../../vendor/bin/phpunit', '--list-tests'], __DIR__ . '/../../..');
127-
$process->run();
128-
129-
return \substr_count($process->getOutput(), \PHP_EOL) - 3; // 3 is for header
130-
}
131-
132108
private static function description(): string
133109
{
134110
return \str_replace(

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22

33
# PHP CS Fixer: custom fixers
44

5-
[![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)
6-
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
7-
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
8-
![Tests](https://img.shields.io/badge/tests-3805-brightgreen.svg)
9-
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
10-
11-
[![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)
12-
[![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)
13-
[![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)
14-
[![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)
5+
[![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)
6+
[![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)
7+
[![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)
8+
[![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)
9+
[![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)
1510

1611
A set of custom fixers for [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).
1712

tests/Readme/ReadmeCommandTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,4 @@ public function testReadmeIsUpToDate(): void
3737
'README.md is not up to date, run "composer fix" to update it.',
3838
);
3939
}
40-
41-
public function testNumberOfTests(): void
42-
{
43-
\preg_match(
44-
'~https://img.shields.io/badge/tests-(\\d+)-brightgreen.svg~',
45-
(string) \file_get_contents(__DIR__ . '/../../README.md'),
46-
$matches,
47-
);
48-
self::assertArrayHasKey(1, $matches);
49-
50-
$expectedNumberOfTests = (int) $matches[1];
51-
52-
$readmeCommand = new \ReflectionClass(ReadmeCommand::class);
53-
$numberOfTests = $readmeCommand->getMethod('numberOfTests');
54-
$numberOfTests->setAccessible(true);
55-
$actualNumberOfTests = $numberOfTests->invoke($readmeCommand->newInstance());
56-
57-
self::assertSame($expectedNumberOfTests, $actualNumberOfTests);
58-
}
5940
}

0 commit comments

Comments
 (0)