You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When upgrading old code bases, rector currently generates a single diff with changes of all rules.
For a more readable and reviewable git history, it is beneficial to do commits for each single rector rule applied.
Integrating automated git commits is currently (v1.2.10) not possible and deemed out of scope: #8505.
Unfortunately, it is also not possible to automate this process with rector.
Possible automation
If rector would provide the necessary features, it would be possible to automate this process:
Get a list of all rules that apply to the code base
Run rector with a single rule only
Create a commit for the changes of each rule
1. List of all relevant rules
Currently it is possible to get a list of the short names of all applying rules:
Unfortunately, this short names do not help very much, since we need the full class in the configuration file.
rector would at least need a way to obtain the full names of the applied rules. Ideally, it would have a separate command that does not generate any diff output, but simply lists the full names of the relevant rules.
2. Run rector for a single rule
This is currently only possible by modifying the rector.php configuration file.
A feature request for an option/parameter #7366 was rejected because short rule names are ambiguous.
When passing full class names, it should not be a problem to find the rule and apply only that.
Feature Request
When upgrading old code bases, rector currently generates a single diff with changes of all rules.
For a more readable and reviewable git history, it is beneficial to do commits for each single rector rule applied.
Integrating automated git commits is currently (v1.2.10) not possible and deemed out of scope: #8505.
Unfortunately, it is also not possible to automate this process with rector.
Possible automation
If rector would provide the necessary features, it would be possible to automate this process:
1. List of all relevant rules
Currently it is possible to get a list of the short names of all applying rules:
Unfortunately, this short names do not help very much, since we need the full class in the configuration file.
rector
would at least need a way to obtain the full names of the applied rules. Ideally, it would have a separate command that does not generate any diff output, but simply lists the full names of the relevant rules.2. Run rector for a single rule
This is currently only possible by modifying the
rector.php
configuration file.A feature request for an option/parameter #7366 was rejected because short rule names are ambiguous.
When passing full class names, it should not be a problem to find the rule and apply only that.
New feature request: #8899.
3. Create a commit
When 1 and 2 are available, creating commits would be easily possible with external scripts. This does not need to be part of rector.
Missing features
What do you think? Would that be a feasible approach to this problem?
Would the separate command to list applying rules be better, or should we go the option-to-list-full-rule-names-in-process route?
The text was updated successfully, but these errors were encountered: