Pre Commit Setup - odoo-ps/pshk-process GitHub Wiki
Info
What is it ?
pre-commit is a git hook script that will run every time you make a commit. It will format your code automatically to the standard of the PS so we can collaborate better. It might sometime not format your code but log the issues it is then your job to fix them so all the tests pass.
Official Documentation
Odoo PS pre-commit Repository
https://github.com/odoo-ps/psbe-ps-tech-tools/tree/14.0-pre-commit-config
Setup
Install
pip3 install copier pre-commit
You have to activate pre-commit in every repository you work on
copier -f --vcs-ref=14.0-pre-commit-config copy [email protected]:odoo-ps/psbe-ps-tech-tools.git .
pre-commit install
It will now run every time you make a commit on this repository.
Every day usage
If you are working on a module that was made without pre-commit
First make a commit with all the pre-commit changes to the original module (message: [REF] name_of_module: pre-commit) To run pre-commit on one module only
git ls-files -- 'module_name/*' | xargs pre-commit run --files
# Fix manually the potential errors
git commit -m "[REF] name_of_module: pre-commit"
Then start your development and make a separate commit for your implementation.