Skip to content

Commit cb5f83a

Browse files
committed
chore(rector): re-enable rector
1 parent ee0ed51 commit cb5f83a

1 file changed

Lines changed: 108 additions & 0 deletions

File tree

rector.php

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?php
2+
3+
/**
4+
* -------------------------------------------------------------------------
5+
* Carbon plugin for GLPI
6+
*
7+
* @copyright Copyright (C) 2024-2025 Teclib' and contributors.
8+
* @license https://www.gnu.org/licenses/gpl-3.0.txt GPLv3+
9+
* @link https://github.com/pluginsGLPI/carbon
10+
*
11+
* -------------------------------------------------------------------------
12+
*
13+
* LICENSE
14+
*
15+
* This file is part of Carbon plugin for GLPI.
16+
*
17+
* This program is free software: you can redistribute it and/or modify
18+
* it under the terms of the GNU General Public License as published by
19+
* the Free Software Foundation, either version 3 of the License, or
20+
* (at your option) any later version.
21+
*
22+
* This program is distributed in the hope that it will be useful,
23+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
* GNU General Public License for more details.
26+
*
27+
* You should have received a copy of the GNU General Public License
28+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
29+
*
30+
* -------------------------------------------------------------------------
31+
*/
32+
33+
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
34+
use Rector\CodeQuality\Rector as CodeQuality;
35+
use Rector\Config\RectorConfig;
36+
use Rector\DeadCode\Rector as DeadCode;
37+
use Rector\ValueObject\PhpVersion;
38+
39+
require_once __DIR__ . '/../../src/Plugin.php';
40+
41+
return RectorConfig::configure()
42+
->withPaths([
43+
__DIR__ . '/ajax',
44+
__DIR__ . '/front',
45+
__DIR__ . '/install',
46+
__DIR__ . '/public',
47+
__DIR__ . '/src',
48+
__DIR__ . '/tools',
49+
])
50+
->withPhpVersion(PhpVersion::PHP_82)
51+
->withCache(
52+
sys_get_temp_dir() . '/rector',
53+
FileCacheStorage::class
54+
)
55+
->withParallel(300)
56+
->withRootFiles()
57+
->withImportNames(removeUnusedImports: true)
58+
// FIXME apply it in another PR, it generates a huge diff ->withImportNames()
59+
->withPreparedSets(
60+
deadCode: true,
61+
codeQuality: true,
62+
codingStyle: true,
63+
)
64+
->withRules([
65+
CodeQuality\Assign\CombinedAssignRector::class,
66+
CodeQuality\BooleanAnd\RemoveUselessIsObjectCheckRector::class,
67+
CodeQuality\BooleanAnd\SimplifyEmptyArrayCheckRector::class,
68+
CodeQuality\BooleanNot\ReplaceMultipleBooleanNotRector::class,
69+
CodeQuality\Catch_\ThrowWithPreviousExceptionRector::class,
70+
CodeQuality\Empty_\SimplifyEmptyCheckOnEmptyArrayRector::class,
71+
CodeQuality\Expression\InlineIfToExplicitIfRector::class,
72+
CodeQuality\Expression\TernaryFalseExpressionToIfRector::class,
73+
CodeQuality\For_\ForRepeatedCountToOwnVariableRector::class,
74+
CodeQuality\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class,
75+
CodeQuality\Foreach_\ForeachToInArrayRector::class,
76+
CodeQuality\Foreach_\SimplifyForeachToCoalescingRector::class,
77+
CodeQuality\Foreach_\UnusedForeachValueToArrayKeysRector::class,
78+
CodeQuality\FuncCall\ChangeArrayPushToArrayAssignRector::class,
79+
CodeQuality\FuncCall\CompactToVariablesRector::class,
80+
CodeQuality\FuncCall\InlineIsAInstanceOfRector::class,
81+
CodeQuality\FuncCall\IsAWithStringWithThirdArgumentRector::class,
82+
CodeQuality\FuncCall\RemoveSoleValueSprintfRector::class,
83+
CodeQuality\FuncCall\SetTypeToCastRector::class,
84+
CodeQuality\FuncCall\SimplifyFuncGetArgsCountRector::class,
85+
CodeQuality\FuncCall\SimplifyInArrayValuesRector::class,
86+
CodeQuality\FuncCall\SimplifyStrposLowerRector::class,
87+
CodeQuality\FuncCall\UnwrapSprintfOneArgumentRector::class,
88+
CodeQuality\Identical\BooleanNotIdenticalToNotIdenticalRector::class,
89+
CodeQuality\Identical\SimplifyArraySearchRector::class,
90+
CodeQuality\Identical\SimplifyConditionsRector::class,
91+
CodeQuality\Identical\StrlenZeroToIdenticalEmptyStringRector::class,
92+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\CombineIfRector::class,
93+
CodeQuality\If_\CompleteMissingIfElseBracketRector::class,
94+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class,
95+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\ExplicitBoolCompareRector::class,
96+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\ShortenElseIfRector::class,
97+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\SimplifyIfElseToTernaryRector::class,
98+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\SimplifyIfNotNullReturnRector::class,
99+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\SimplifyIfNullableReturnRector::class,
100+
// FIXME apply it in another PR, it generates a huge diff CodeQuality\If_\SimplifyIfReturnBoolRector::class,
101+
CodeQuality\Include_\AbsolutizeRequireAndIncludePathRector::class,
102+
CodeQuality\LogicalAnd\AndAssignsToSeparateLinesRector::class,
103+
CodeQuality\LogicalAnd\LogicalToBooleanRector::class,
104+
CodeQuality\NotEqual\CommonNotEqualRector::class,
105+
CodeQuality\Ternary\UnnecessaryTernaryExpressionRector::class,
106+
DeadCode\Assign\RemoveUnusedVariableAssignRector::class,
107+
])
108+
;

0 commit comments

Comments
 (0)