forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
109 lines (105 loc) · 4.19 KB
/
Copy pathrector.php
File metadata and controls
109 lines (105 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
# https://getrector.com/documentation
declare(strict_types=1);
use OpenEMR\Rector\Rules\CatchExceptionToThrowableRector;
use OpenEMR\Rector\Rules\ConsolidateImportsRector;
use OpenEMR\Rector\Rules\OEGlobalsBagTypedGettersRector;
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector;
use Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector;
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\ValueObject\PhpVersion;
return RectorConfig::configure()
->withBootstrapFiles([
__DIR__ . '/rector-bootstrap.php',
])
// Keep this list aligned with the paths in phpstan.neon.dist.
->withPaths([
__DIR__ . '/Documentation',
__DIR__ . '/_rest_routes.inc.php',
__DIR__ . '/acl_upgrade.php',
__DIR__ . '/admin.php',
__DIR__ . '/apis',
__DIR__ . '/ccdaservice',
__DIR__ . '/ccr',
__DIR__ . '/cli',
__DIR__ . '/config',
__DIR__ . '/contrib',
__DIR__ . '/controller.php',
__DIR__ . '/controllers',
__DIR__ . '/custom',
__DIR__ . '/gacl',
__DIR__ . '/index.php',
__DIR__ . '/interface',
__DIR__ . '/ippf_upgrade.php',
__DIR__ . '/library',
__DIR__ . '/oauth2',
__DIR__ . '/portal',
__DIR__ . '/setup.php',
__DIR__ . '/sites',
__DIR__ . '/sphere',
__DIR__ . '/sql_patch.php',
__DIR__ . '/sql_upgrade.php',
__DIR__ . '/src',
__DIR__ . '/templates',
__DIR__ . '/tests',
__DIR__ . '/tools/release/bin',
__DIR__ . '/tools/release/src',
__DIR__ . '/version.php',
])
// oe-module-claimrev-connect is a Composer dependency
// (claimrevolution/oe-module-claimrev-connect), relocated into this path by
// the oe-module-installer-plugin during `composer install`. It is
// third-party code, not maintained in this repo, so skip it the same way
// vendor/ is skipped.
->withSkip([
__DIR__ . '/interface/modules/custom_modules/oe-module-claimrev-connect',
// The Firehed container compiler inlines closure source code into the
// compiled container; first-class callables have no closure body to
// extract, so this rule breaks container compilation for definitions
// under config/.
ArrowFunctionDelegatingCallToFirstClassCallableRector::class => [
__DIR__ . '/config',
],
])
->withCache(
// ensure file system caching is used instead of in-memory
cacheClass: FileCacheStorage::class,
// specify a path that works locally as well as on CI job runners
cacheDirectory: '/tmp/rector'
)
// Scan non-composer-autoloaded class directories so type inference is
// identical whether rector analyzes the full withPaths tree or just the
// filenames a pre-commit hook passes. See the comment in the neon file.
->withPHPStanConfigs([
__DIR__ . '/.phpstan/rector-scan.neon',
])
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
'allow_model_based_classes' => true,
'inline_public' => false,
'rename_property' => true,
])
// https://getrector.com/documentation/troubleshooting-parallel
->withParallel(
timeoutSeconds: 1200,
maxNumberOfProcess: 12,
jobSize: 12
)
// FIXME rector should pick the php version from composer.json
// but that doesn't seem to be working, so hard-coding for now.
->withPhpVersion(PhpVersion::PHP_82)
->withRules([
CallUserFuncArrayToVariadicRector::class,
CatchExceptionToThrowableRector::class,
ConsolidateImportsRector::class,
OEGlobalsBagTypedGettersRector::class,
SimplifyIfElseToTernaryRector::class,
UnnecessaryTernaryExpressionRector::class,
])
->withPhpSets()
->withDeadCodeLevel(5)
->withCodeQualityLevel(5)
->withTypeCoverageLevel(7);