Skip to content

Commit 8c86060

Browse files
author
Marcin Czarnecki
committed
build(ci): Add Rector into static analysis.
1 parent 4ff99e4 commit 8c86060

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

.github/workflows/rector.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Coding Standards"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
jobs:
10+
coding-standards:
11+
name: "Coding Standards"
12+
runs-on: "ubuntu-20.04"
13+
14+
strategy:
15+
matrix:
16+
php-version:
17+
- "7.4"
18+
19+
steps:
20+
- name: "Checkout"
21+
uses: "actions/checkout@v2"
22+
23+
- name: "Install PHP"
24+
uses: "shivammathur/setup-php@v2"
25+
with:
26+
coverage: "none"
27+
php-version: "${{ matrix.php-version }}"
28+
tools: "cs2pr"
29+
extensions: pdo_sqlite
30+
31+
- name: "Install dependencies with Composer"
32+
uses: "ramsey/composer-install@v1"
33+
34+
- name: "Run PHP_CodeSniffer"
35+
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"

.github/workflows/static-analysis.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ jobs:
3838

3939
- name: "Run a static analysis with phpstan/phpstan"
4040
run: "vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"
41+
42+
- name: "Run a static analysis with rector/rector"
43+
run: "vendor/bin/rector --dry-run"
44+
if: ${{ matrix.php-version == 8.2 }}

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"phpstan/phpstan": "^1.0.2",
4242
"phpunit/phpunit": "^9.0 || ^10.0",
4343
"psr/container": "^1.0 || ^2.0",
44+
"rector/rector": "^0.18.13",
4445
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
4546
"symfony/expression-language": "^5.4 || ^6.0 || ^7.0",
4647
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0",

rector.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Set\ValueObject\LevelSetList;
7+
8+
return static function (RectorConfig $rectorConfig) {
9+
$rectorConfig->paths([
10+
__DIR__ . '/src',
11+
]);
12+
$rectorConfig->sets([LevelSetList::UP_TO_PHP_74]);
13+
};

0 commit comments

Comments
 (0)