Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: Pre-commit updates
by
Ecosoft Co. Ltd., Kitti Upariphutthiphong
That's great news!
Thank you so much for keep improving things. ;)
On Fri, Jan 24, 2020, 9:02 PM Jairo Llopis <jairo.llopis@tecnativa.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:
- .scss/.css
- .js
- .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_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe