Skip to content

Commit

Permalink
Fixed Rector scanning too many files.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed May 10, 2024
1 parent 9912965 commit 9279cf6
Showing 1 changed file with 16 additions and 27 deletions.
43 changes: 16 additions & 27 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,23 @@
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;

return static function (RectorConfig $rectorConfig): void {
$drupalFinder = new DrupalFinder();
$drupalFinder->locateRoot(__DIR__);
$drupalRoot = $drupalFinder->getDrupalRoot();

$rectorConfig->autoloadPaths([
$drupalRoot . '/core',
$drupalRoot . '/modules',
$drupalRoot . '/themes',
$drupalRoot . '/profiles',
]);

$rectorConfig->paths([
__DIR__,
$drupalRoot . '/modules/custom',
$drupalRoot . '/themes/custom',
$drupalRoot . '/sites/default/settings.php',
$drupalRoot . '/sites/default/includes',
__DIR__ . '/tests',
]);

$rectorConfig->sets([
Expand All @@ -52,17 +67,6 @@

$rectorConfig->rule(DeclareStrictTypesRector::class);

$drupalFinder = new DrupalFinder();
$drupalFinder->locateRoot(__DIR__);

$drupalRoot = $drupalFinder->getDrupalRoot();
$rectorConfig->autoloadPaths([
$drupalRoot . '/core',
$drupalRoot . '/modules',
$drupalRoot . '/themes',
$drupalRoot . '/profiles',
]);

$rectorConfig->skip([
// Rules added by Rector's rule sets.
ArraySpreadInsteadOfArrayMergeRector::class,
Expand All @@ -77,21 +81,6 @@
// Dependencies.
'*/vendor/*',
'*/node_modules/*',
// Core and contribs.
'*/core/*',
'*/modules/contrib/*',
'*/themes/contrib/*',
'*/profiles/contrib/*',
'*/sites/default/default.settings.php',
// Files.
'*/sites/default/files/*',
'*/sites/simpletest/*',
// Scaffold files.
'*/autoload.php',
'*/index.php',
'*/update.php',
// Composer scripts.
'*/scripts/composer/*',
]);

$rectorConfig->fileExtensions([
Expand Down

1 comment on commit 9279cf6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.