-
-
Notifications
You must be signed in to change notification settings - Fork 29
[#2975] Replaced versioned Drupal Rector sets with the composer-based set. #2977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/theme_claro/rector.php
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/theme_olivero/rector.php
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/theme_stark/rector.php
This file contains hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/rector.php
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
...x/cli/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/rector.php
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/tools_no_behat/rector.php
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/tools_no_behat_circleci/rector.php
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/tools_no_eslint_no_theme/rector.php
This file contains hidden or 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
4 changes: 2 additions & 2 deletions
4
.vortex/cli/tests/Fixtures/handler_process/tools_no_phpunit/rector.php
This file contains hidden or 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
4 changes: 2 additions & 2 deletions
4
.vortex/cli/tests/Fixtures/handler_process/tools_no_phpunit_circleci/rector.php
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
.vortex/cli/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/rector.php
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
find .artifacts -maxdepth 1 -type f -name 'docs-*.md' -printRepository: drevops/vortex
Length of output: 198
🏁 Script executed:
Repository: drevops/vortex
Length of output: 244
🏁 Script executed:
Repository: drevops/vortex
Length of output: 227
🏁 Script executed:
Repository: drevops/vortex
Length of output: 210
🌐 Web query:
Drupal Rector 1.1.2 withComposerBased drupal DrupalSetProvider withSetProviders💡 Result:
In Drupal Rector 1.1.2, you can use the withComposerBased and withSetProviders methods to automate the selection of Drupal upgrade rules based on your installed drupal/core version, eliminating the need to manually manage lists of upgrade sets [1][2][3]. To implement this, update your rector.php configuration file as follows [2]: return RectorConfig::configure ->withSetProviders(\DrupalRector\Set\DrupalSetProvider::class) ->withComposerBased(drupal: true); By using this configuration: 1. withSetProviders(\DrupalRector\Set\DrupalSetProvider::class) registers the Drupal-specific rule sets [2][4]. 2. withComposerBased(drupal: true) instructs Rector to inspect your project's composer.json, identify the installed version of drupal/core, and automatically load the relevant upgrade rules up to and including that minor version [1][2]. This approach is dynamic; as you upgrade your Drupal core version, Rector will automatically adjust the sets it applies without requiring further manual updates to your rector.php [2]. This feature requires Rector 2.5.0 or newer [2][5].
Citations:
🌐 Web query:
site:github.com/palantirnet/drupal-rector "withComposerBased" "DrupalSetProvider"💡 Result:
The withComposerBased method is a feature of the drupal-rector project, used to automatically select and apply Rector deprecation sets based on the version of drupal/core installed in your project [1][2]. Usage: To use this feature, you must register the DrupalSetProvider and configure the withComposerBased option in your rector.php file [1]: return RectorConfig::configure ->withSetProviders(\DrupalRector\Set\DrupalSetProvider::class) ->withComposerBased(drupal: true); How it works: When configured this way, Rector inspects your project's installed drupal/core version [1]. It then automatically loads the relevant deprecation sets for all Drupal minor versions up to and including your current installed version [1]. For example, if your site is on Drupal 11.2, it will load sets covering 11.0 through 11.2, while excluding future minor versions [1]. Key benefits: - Version Accuracy: It ensures that your code is only updated for deprecations relevant to your specific Drupal installation, preventing the application of premature or unnecessary rules [1][2]. - Automatic Breaking Changes: Because the exact version is known, Rector can safely include "breaking" sets (rules for renames introduced in specific minor versions) that would otherwise be unsafe to apply without version awareness [1]. - Simplified Configuration: It removes the need to manually list or update deprecation sets in your configuration as you upgrade your Drupal core [1]. Important Note: This feature typically requires a compatible version of the rector package that supports the SetGroup::DRUPAL constant and the withComposerBased toggle [1][2]. As it is designed for your specific installed version, it is intended for projects that do not need to maintain simultaneous compatibility with multiple older Drupal versions [2].
Citations:
🏁 Script executed:
Repository: drevops/vortex
Length of output: 14763
🏁 Script executed:
Repository: drevops/vortex
Length of output: 657
🏁 Script executed:
Repository: drevops/vortex
Length of output: 6414
🏁 Script executed:
Repository: drevops/vortex
Length of output: 6366
🏁 Script executed:
Repository: drevops/vortex
Length of output: 152
🏁 Script executed:
git ls-files '*composer*'Repository: drevops/vortex
Length of output: 5453
🏁 Script executed:
rg -n -i 'rector|drupal-rector' composer.json .vortex/cli/composer.json .vortex/cli/tests/Fixtures/handler_process/_baseline/composer.jsonRepository: drevops/vortex
Length of output: 776
Register
DrupalSetProviderin both Rector configurations.withComposerBased(drupal: TRUE)requiresDrupalRector\Set\DrupalSetProvider. Add the import and->withSetProviders(DrupalSetProvider::class)torector.phpand.vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php.📍 Affects 2 files
rector.php#L102-L105(this comment).vortex/cli/tests/Fixtures/handler_process/_baseline/rector.php#L100-L103🤖 Prompt for AI Agents
Source: MCP tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, and thank you - this was a real bug, not a style nit. Verified with
vendor/bin/rector list-rules: 0DrupalRectorrules loaded without the provider, 98 with it.withComposerBased(drupal: TRUE)only pushesSetGroup::DRUPALonto$setGroups; nothing supplies sets for that group unlessDrupalSetProvideris registered, so Rector loaded no Drupal rules at all and still exited 0. Lint was green while covering nothing.This pull request was merged before the fix could land here, so it is in #2979 instead, which adds
->withSetProviders(DrupalSetProvider::class)to bothrector.phpand the regenerated_baseline/rector.phpfixture.One consequence worth recording: registering the provider loads the Drupal 11.0-11.4 sets for the installed
drupal/core11.4.5, which newly enablesPhpUnitAddRunTestsInSeparateProcessesAttributeRectorfrom the 11.4 set. That adds#[RunTestsInSeparateProcesses]to the 8 example Kernel and Functional test classes, so those are updated in #2979 as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexSkrypnyk, thank you for the detailed verification.The finding is valid.
withComposerBased(drupal: TRUE)alone did not load Drupal rule sets. The green Rector exit status was therefore not sufficient validation.#2979contains the required provider registration and the related Drupal 11.4 test-class updates. ThePhpUnitAddRunTestsInSeparateProcessesAttributeRectoreffect is also clear.🐇 ✓
✏️ Learnings added
You are interacting with an AI system.