Skip to content

Commit f505af9

Browse files
committed
autofix ecs & rector
1 parent addf969 commit f505af9

File tree

4 files changed

+92
-82
lines changed

4 files changed

+92
-82
lines changed

.github/workflows/autofix.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: fixer
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
autofix:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 8.2
21+
extensions: bcmath
22+
env:
23+
runner: self-hosted
24+
25+
- name: Validate composer.json and composer.lock
26+
run: composer validate --strict
27+
28+
- name: Cache Composer packages
29+
id: composer-cache
30+
uses: actions/cache@v4
31+
with:
32+
path: vendor
33+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-php-
36+
37+
- name: Install dependencies
38+
run: composer install --prefer-dist --no-progress
39+
40+
- name: Run rector-fix
41+
run: composer rector-fix
42+
43+
- name: Run ecs-fix
44+
run: composer ecs-fix
45+
46+
- name: Run rector
47+
run: composer rector
48+
49+
- name: Run ecs
50+
run: composer ecs
51+
52+
- name: Run parabench
53+
run: composer parabench
54+
55+
- name: "Check if build has changed"
56+
if: success()
57+
id: has-changes
58+
run: |
59+
echo "stdout<<EOF" >> $GITHUB_OUTPUT
60+
echo "$(git diff --stat)" >> $GITHUB_OUTPUT
61+
echo 'EOF' >> $GITHUB_OUTPUT
62+
63+
- name: Import GPG key
64+
if: ${{ steps.has-changes.outputs.stdout }}
65+
uses: crazy-max/ghaction-import-gpg@v6
66+
with:
67+
gpg_private_key: ${{ secrets.GPG_BOT }}
68+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
69+
fingerprint: ${{ secrets.GPG_FINGERPRINT }}
70+
git_config_global: true
71+
git_user_signingkey: true
72+
git_commit_gpgsign: true
73+
git_committer_name: Github bot
74+
git_committer_email: [email protected]
75+
76+
- name: "Commit files"
77+
if: ${{ steps.has-changes.outputs.stdout }}
78+
env:
79+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
80+
run: |
81+
gh pr checkout ${{ github.event.pull_request.number }}
82+
git commit -S -m "autofix" -a
83+
84+
- name: "Push changes"
85+
if: ${{ steps.has-changes.outputs.stdout }}
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
88+
run: git push -u origin HEAD

.github/workflows/code-style.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/rector.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

rector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
// Define what rule sets will be applied
1717
$config->import(PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES);
1818
$config->import(PHPUnitSetList::PHPUNIT_100);
19+
$config->import(SetList::STRICT_BOOLEANS);
20+
$config->import(SetList::PRIVATIZATION);
21+
$config->import(SetList::EARLY_RETURN);
22+
$config->import(SetList::INSTANCEOF);
1923
$config->import(SetList::CODE_QUALITY);
2024
$config->import(SetList::DEAD_CODE);
2125
$config->import(SetList::PHP_82);

0 commit comments

Comments
 (0)