From 811ad9e1510f8a5eddcaa1bc6643bab1b9a5adad Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Sat, 11 May 2024 06:57:09 +1000 Subject: [PATCH] Fixed Rector scanning too many files. --- rector.php | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/rector.php b/rector.php index 3131d3b5f..cbba12cfc 100644 --- a/rector.php +++ b/rector.php @@ -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([ @@ -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, @@ -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([