From 5375e06fb9baa37a99fc8f3efb06f050e8b9f448 Mon Sep 17 00:00:00 2001 From: Anatoliy Poloz Date: Thu, 21 Dec 2023 09:20:49 +0300 Subject: [PATCH] rectore auto-code-review added --- .gitea/workflows/test.yaml | 2 + composer.json | 2 + composer.lock | 92 +++++++++++++++++++++++++++++++++++++- rector.php | 29 ++++++++++++ 4 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 rector.php diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index a7fbed2..80105f8 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -62,6 +62,8 @@ jobs: - name: Run test run: vendor/bin/phpunit + - name: Code Rewiew + run: vendor/bin/rector process --dry-run #- name: Run Pint # run: vendor/bin/pint diff --git a/composer.json b/composer.json index 20adde8..f93c9ec 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,7 @@ }, "require-dev": { "barryvdh/laravel-ide-helper": "^2.13", + "driftingly/rector-laravel": "^0.26.2", "fakerphp/faker": "^1.21", "larastan/larastan": "^2.7", "laravel/pint": "^1.13", @@ -39,6 +40,7 @@ "nunomaduro/phpinsights": "^2.11", "phpunit/phpunit": "^10.0", "psalm/phar": "^5.13", + "rector/rector": "^0.18.13", "spatie/laravel-ignition": "^2.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index de1d128..3710b63 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cec18c9498d636695e0fcc9ba3d8ef15", + "content-hash": "71767f4485e6335b0a9d934fafcfad8e", "packages": [ { "name": "asantibanez/livewire-charts", @@ -10152,6 +10152,40 @@ }, "time": "2023-01-05T11:28:13+00:00" }, + { + "name": "driftingly/rector-laravel", + "version": "0.26.2", + "source": { + "type": "git", + "url": "https://github.com/driftingly/rector-laravel.git", + "reference": "cf6d0a7c8e2dc33b6e2bb8ccb4638f44a5c09671" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/cf6d0a7c8e2dc33b6e2bb8ccb4638f44a5c09671", + "reference": "cf6d0a7c8e2dc33b6e2bb8ccb4638f44a5c09671", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "rector-extension", + "autoload": { + "psr-4": { + "RectorLaravel\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Rector upgrades rules for Laravel Framework", + "support": { + "issues": "https://github.com/driftingly/rector-laravel/issues", + "source": "https://github.com/driftingly/rector-laravel/tree/0.26.2" + }, + "time": "2023-10-11T21:42:53+00:00" + }, { "name": "filp/whoops", "version": "2.15.4", @@ -12025,6 +12059,62 @@ }, "time": "2023-12-16T09:41:14+00:00" }, + { + "name": "rector/rector", + "version": "0.18.13", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "f8011a76d36aa4f839f60f3b4f97707d97176618" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f8011a76d36aa4f839f60f3b4f97707d97176618", + "reference": "f8011a76d36aa4f839f60f3b4f97707d97176618", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.35" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.18.13" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2023-12-20T16:08:01+00:00" + }, { "name": "sebastian/cli-parser", "version": "2.0.0", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..fdad3c1 --- /dev/null +++ b/rector.php @@ -0,0 +1,29 @@ +paths([ + __DIR__ . '/app', + __DIR__ . '/bootstrap', + __DIR__ . '/config', + __DIR__ . '/lang', + __DIR__ . '/public', + __DIR__ . '/resources', + __DIR__ . '/routes', + __DIR__ . '/tests', + ]); + +// $rectorConfig->import(SetList::CODING_STYLE); +// $rectorConfig->import(SetList::CODE_QUALITY); + $rectorConfig->import(SetList::DEAD_CODE); +// $rectorConfig->import(NetteSetList::NETTE_UTILS_CODE_QUALITY); +// $rectorConfig->import(LevelSetList::UP_TO_PHP_82); + $rectorConfig->import(LaravelSetList::LARAVEL_100); +}; +