Problem/Motivation

Rector can create patches for projects with code deprecations and it keeps getting better (by more rules being added to it). See https://www.palantir.net/blog/jumpstart-your-drupal-9-upgrade-drupal-rector

Most module maintainers are not aware of Rector and how it can help them get their code ready for the next major version of Drupal core. It's a huge time consuming task to manually run Rector on every module, every time Rector gets a new rule added.

Proposed resolution

Create a bot that runs on d.o to generate patches automatically and allow module maintainers communicate what kind and if they are interested in the bot's help.

When the bot that is running Rector finds code deprecation in a module:

  1. It will look for an existing issue with a specific name in that project (eg. "Code deprecations that can be fixed by Drupal Rector), if that issue does not exist - it will create a new issue for that project and the tag the issue with "RectorAutoPatchD9".
  2. If the finds the issue but it closed or the "RectorAutoPatchD9" patch has been removed it will skip the issue.
  3. It will add the latest patch (if it is different than the patch Rector created the last time it ran)
  4. If the issue is still set to 8.x, the patch can include adding `core_version_requirement` key in info.yml file of the module, if that line doesn't exist yet.

Module developers can edit that specific issue in order to control/communicate with the bot, for example, they can:

  1. Change the version of the issue (eg. from 8.x-1.x to 8.x-1.0) - for the bot to make a patch against a branch or a specific release.
  2. Change the status to "will not fix" (or another option), for the bot to stop sending patches on that issue.
  3. Remove or add back the "RectorAutoPatchD9" tag to trigger stopping/starting automated patches

This way we think it will create very little "noise" for module developers and will give them some control.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

shaal created an issue. See original summary.

tedbow’s picture

@shaal thanks for the creating this issue!

I think this is great idea. We talked about this at Florida DrupalCamp. Here are a couple other things we talked about that I think would help this plan(@shaal may or may not agree with these)

I think to minimize to push back from module maintainers it would be great if

  1. There are could be a blog post from on drupal.org explaining that issues are going to be created by the bot before it is run
  2. That a special drupal.org account should be created for the bot to use to post patches on the issue. This will hopefully stop people from worrying that the bot is being used to game the issue credit system.
  3. All the issue should being created have a template that 1) explains how to stop the bot from posting more patches and 2) links to the blog post on drupal.org about the bot

I think these steps would help because a lot maintainers will be surprised by this automated patch especially if the maintain multiple modules and see the issues on all of them at once.

gábor hojtsy’s picture

Issue summary: View changes

Linked in the palantir.net blog post.

tedbow’s picture

I am working on sample issue that bot would create here #3127528: Rector Example issue

tedbow’s picture

Issue summary: View changes
agentrickard’s picture

Status: Active » Fixed

This was completed but the issue never closed.

agentrickard’s picture

Status: Fixed » Closed (fixed)