I’ve noticed that some new contributors fail to install pre-commit, and then we have to lint their PRs for them, or teach them how to lint it. For regular contributors, I like the second route, but for drive-by contributions a bot that does the fix may be helpful.
The bot does a pre-commit check, and if it fails you can comment on the PR and instruct the bot to fix it.
This makes sense to me. I’ve suggested doing the same on another project but that has not gone live yet. It would also help with regular contributors making quick pull requests via edits in the GitHub website - every so often I mess up a linting rule like white space that way.
I am using the pre-commit.ci service to automatically periodically update the hooks (e.g. new versions of flake8), which works well but I find the default weekly frequency too much.
Sounds useful. I can’t remember the reasons why we stopped using the pep8 bot; do those apply here? Also do you have an example of the bot in action? How useful or confusing this bot is to new contributors might depend entirely on how the bot’s messages are worded. Especially if they have to pull changes from the remote PR branch.
We use it in napari with autofixes. ie you don’t even need to comment to bring in the bot. And I find it quite obnoxious! (Was gonna link to a Zulip discussion but it’s in the core devs group it turns out. ) But with a comment I think it’s ok, you could do
@pre-commit.ci please fix
@contributor, we just pushed some commits normalising style to our repo's standards (link to contributor guidelines), please pull before making additional changes! Thank you!
We just discussed at the community call, and @jarrodmillman noted that if the bot used suggestions instead of making a patch, that’d be much more useful. I agree, so maybe we punt on this until that feature arrives.