-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Edouard Cunibil <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use DrupalFinder\DrupalFinder; | ||
use DrupalRector\Set\Drupal8SetList; | ||
use DrupalRector\Set\Drupal9SetList; | ||
use Rector\Config\RectorConfig; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
// Adjust the set lists to be more granular to your Drupal requirements. | ||
// @todo find out how to only load the relevant rector rules. | ||
// Should we try and load \Drupal::VERSION and check? | ||
$rectorConfig->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); | ||
}; |