Skip to content

Commit 5a9da81

Browse files
committed
ci: add ecs linter
1 parent fdf03e6 commit 5a9da81

File tree

6 files changed

+148
-29
lines changed

6 files changed

+148
-29
lines changed

.github/workflows/ci.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ jobs:
2222
- name: ⬇️ Install dependencies
2323
run: composer install --ignore-platform-reqs
2424

25+
- name: 💅 Lint
26+
run: composer lint
27+
2528
- name: ✅ Run the tests
26-
run: composer phpunit
29+
run: composer test

composer.json

+5-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"php": "^8.3"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "^11.1"
18+
"phpunit/phpunit": "^11.1",
19+
"codelytv/coding-style": "^1.2"
1920
},
2021
"autoload": {
2122
"psr-4": {
@@ -30,12 +31,8 @@
3031
"minimum-stability": "stable",
3132
"prefer-stable": true,
3233
"scripts": {
33-
"style": "phpcs -p --standard=PSR2 src tests",
34-
"fix-style": "phpcbf -p --standard=PSR2 src tests",
35-
"phpunit": "phpunit --configuration phpunit.xml",
36-
"test": [
37-
"phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests",
38-
"phpunit --configuration phpunit.xml"
39-
]
34+
"test": "phpunit --configuration phpunit.xml",
35+
"lint": "ecs check",
36+
"lint:fix": "ecs check --fix"
4037
}
4138
}

composer.lock

+109-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ecs.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
use CodelyTv\CodingStyle;
4+
use Symplify\EasyCodingStandard\Config\ECSConfig;
5+
6+
return function (ECSConfig $ecsConfig): void {
7+
$ecsConfig->paths([__DIR__ . '/src',]);
8+
$ecsConfig->paths([__DIR__ . '/tests',]);
9+
10+
$ecsConfig->sets([CodingStyle::DEFAULT]);
11+
};

src/Codelyber.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66

77
final class Codelyber
88
{
9-
private const string GREETING = "CodelyTV";
9+
private const string GREETING = 'CodelyTV';
1010

11-
private string $name;
11+
private string $name;
1212

13-
public function __construct(string $name)
14-
{
15-
$this->name = $name;
16-
}
13+
public function __construct(string $name)
14+
{
15+
$this->name = $name;
16+
}
1717

18-
public function name(): string
19-
{
20-
return $this->name;
21-
}
18+
public function name(): string
19+
{
20+
return $this->name;
21+
}
2222

23-
public function greet(): string
24-
{
25-
return self::GREETING;
26-
}
23+
public function greet(): string
24+
{
25+
return self::GREETING;
26+
}
2727
}

tests/CodelyberTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
final class CodelyberTest extends TestCase
1212
{
13-
#[Test] public function itShouldSayHelloWhenGreeting(): void
14-
{
15-
$codelyber = new Codelyber("Javi");
13+
#[Test] public function itShouldSayHelloWhenGreeting(): void
14+
{
15+
$codelyber = new Codelyber('Javi');
1616

17-
$this->assertEquals("CodelyTV", $codelyber->greet());
18-
}
17+
$this->assertEquals('CodelyTV', $codelyber->greet());
18+
}
1919
}

0 commit comments

Comments
 (0)