rectore auto-code-review added

This commit is contained in:
Anatoliy Poloz
2023-12-21 09:20:49 +03:00
parent 9c7dae4e37
commit 5375e06fb9
4 changed files with 124 additions and 1 deletions

View File

@@ -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

View File

@@ -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": {

92
composer.lock generated
View File

@@ -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",

29
rector.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
// use Rector\Nette\Set\NetteSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use RectorLaravel\Set\LaravelSetList;
return function (RectorConfig $rectorConfig): void {
$rectorConfig->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);
};