diff --git a/.lando.yml b/.lando.yml index 473b225..ec77634 100644 --- a/.lando.yml +++ b/.lando.yml @@ -12,7 +12,7 @@ services: - apt-get install -y nodejs - npm install --global yarn run: - - cd /app/web && composer require drush/drush && composer install + - cd /app/web && composer require drush/drush palantirnet/drupal-rector && composer install - mkdir -p private/browsertest_output - yarn install --non-interactive --cwd /app/web/core overrides: @@ -43,6 +43,9 @@ tooling: service: appserver cmd: web/vendor/drush/drush/drush --root=/app/web --uri=https://drupal-contributions.lndo.site + rector: + service: appserver + cmd: web/vendor/bin/rector si: service: appserver description: Install Drupal diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..58008df --- /dev/null +++ b/rector.php @@ -0,0 +1,37 @@ +sets([ + Drupal8SetList::DRUPAL_8, + Drupal9SetList::DRUPAL_9, + ]); + + $parameters = $rectorConfig->parameters(); + + $drupalFinder = new DrupalFinder(); + // Use the appropriate folder so DrupalFinder knows what to do. + $drupalFinder->locateRoot(__DIR__ . '/web'); + $drupalRoot = $drupalFinder->getDrupalRoot(); + $rectorConfig->autoloadPaths([ + $drupalRoot . '/core', + $drupalRoot . '/modules', + $drupalRoot . '/profiles', + $drupalRoot . '/themes' + ]); + + $rectorConfig->skip(['*/upgrade_status/tests/modules/*']); + $rectorConfig->fileExtensions(['php', 'module', 'theme', 'install', 'profile', 'inc', 'engine']); + $rectorConfig->importNames(true, false); + $rectorConfig->importShortClasses(false); + $parameters->set('drupal_rector_notices_as_comments', true); +};