You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org
Tool:Fix Suggester Bot
|Fix Suggester Bot|
|Description||Generate fix suggestions using code quality tools, and post suggestions to patches in code review|
|Keywords||bot, code quality|
|License||GNU General Public License 3.0 or later|
|Issues||Open tasks · Report a bug|
A set of scripts running on Toolforge to analyze patches and offer fix suggestions when the patches fail code quality tool analysis.
|Code review system||phpcs||eslint|
How does it work
Two jobs are running the Toolforge jobs framework environment task T285944.
The first one subscribes to "patchset-created" events via Gerrit stream events using an SSH key associated with the Fix Suggester Bot account in Gerrit:
toolforge-jobs run fix-suggester-bot-subscribe --command "php fix-suggester-bot/bin/console fix-suggester-bot:subscribe:gerrit -v" --image tf-php74 --continuous
The above command puts the JSON stream message from Gerrit into a MySQL database table.
Another process is responsible for consuming the messages in the queue:
toolforge-jobs run fix-suggester-bot-consume --command "php fix-suggester-bot/bin/console messenger:consume --time-limit=3600 gerrit_async -vv" --image tf-php74 --continuous
This command runs configured code quality tools (phpcs, currently) and generates fix suggestions in a JSON file. These are then posted as fix suggestion in Gerrit.
At the moment, it only listens to events for the mediawiki/extensions/GrowthExperiments project.
Both commands are configuring using an env.local file in /data/project/fixsuggesterbot/fix-suggester-bot