Contributors mailing list archives
Re: Pre-commit updatesby
Thanks for your hard work
On Mon, 9 Mar 2020, 1:07 pm Jairo Llopis, <email@example.com> wrote:
Thanks a lot!El sáb., 7 mar. 2020 a las 12:47, Stéphane Bidoul (<firstname.lastname@example.org>) escribió:Okay folks, after a few weeks of fine tuning we are ready to launch this update.Here is a typical example of what this will do: https://github.com/OCA/queue/commit/ca187a05bbdd4f00870fa13d678c3d9d2f40ea52I just wanted to insist on the fact that all XML files on the 13.0 branches are going to be reformatted.This is for the better, IMO, but if you have major refactorings in progress this may disturb your workflow.So if any PSC want to temporarily opt-out some repos of this update, let me know before Friday March 13th.Best regards,-sbiOn Fri, Jan 24, 2020 at 3:02 PM Jairo Llopis <email@example.com> wrote:tl;dr: pre-commit is getting updated, expect conflicts in your PRs. XML and JS autoformatting!Hi community.As you might know, for v13 we took a big step forward in our coding standards introducing pre-commit in our workflow, which rewrites all python code in a beautiful-enough fashion.After the work we've done in https://github.com/OCA/maintainer-quality-tools/pull/618, our dear Stéphane Bidoul will soon update the pre-commit configuration and it will enable even more code automatic standardization.In this case, the main change comes from the inclusion of Prettier and ESLint --fix in our pipeline. They will take the job of prettifying code of these files:
- .xml (via prettier plugin)
- Others not so common in our codebase: .md, .html, .less, .yaml
- Before you ask, files created or modified by bots are excluded from the reformat.
- Only for v13+The case for JS is a little bit special in the sense that style changes will be done by Prettier, and AST changes will be done by ESLit, but ESLint still have some linter rules that are not autofixable, and in such case your commit will fail until you satisfy them manually.Given this will produce a big diff commit (just like isort+black did), I took this chance to update some of the tools that we were already using, so there could be a little more diff in python maybe. It shouldn't be too much.We hope this saves you a lot of time and pain when writing these files. Just write ugly & quick code, and pre-commit will handle the rest 😁How does this affect you?Really not much; just:
- Your open PRs could get conflicts. Rebase it and fix them as usual.
- Remember to do pre-commit install when you clone a repo.
- JS code might need an update to satisfy the linter.
- You are encouraged to enable eslint, black, prettier and editorconfig plugins in your favourite IDE, as you probably already did with flake8 and pylint. They should work out of the box, although pre-commit is the maximum authority regarding code reformatting because it works exactly the same in all envs.The change is planned for february 15th, although Stéphane will tell more details in this thread if needed (please) and I'm advancing it for web and website where the change is most interesting.Have a nice day!--Jairo Llopis