Contributors mailing list archives

Browse archives


Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring

Serpent Consulting Services, Jay Vora
- 28/06/2022 07:37:07
Excellent work man!
+1 for repo.

On Tue, Jun 28, 2022 at 1:42 AM Moises Lopez <> wrote:
Currently, we are using pylint-odoo project as pre-commit hooks for other kind of files

Now, we are using pre-commit for new projects.

So we can remove all the checks unrelated with python from pylint-odoo
e.g. eslint (javascript lints), XML checks, PO (translations) checks and so on

Then they could be replaced in the pre-commit configuration file with the id of the related check

There are other custom checks in pylint-odoo as unnecessary-utf8-coding-comment
But it is duplicated with the following hook id fix-encoding-pragma from:

It even has the option to auto-fix it

Similar case for pylint-odoo check incoherent-interpreter-exec-perm:

Similar case for pylint-odoo check wrong-tabs-instead-of-spaces

They are duplicated from pylint-odoo and they are better since they have the option to auto-fix if you want.

But there are other kinds of custom checks in pylint-odoo unrelated with python files that could be good to create a new pre-commit-hook custom for Odoo modules

In order to check XMLs, PO, CSS, CSV, and so on in the context of Odoo modules.

Currently, pylint-odoo is overloaded trying to do checks for non-python code since the core is not supporting check non-python files
And pylint-odoo doesn't have the auto-fix option

e.g. for XML files: 
 - dangerous-filter-wo-user
 - duplicate-xml-record-id
 - deprecated-openerp-xml-node
 - create-user-wo-reset-password
 - duplicate-xml-fields
 - redundant-modulename-xml
 - deprecated-data-xml-node

e.g. for CSV files:
 - duplicate-id-csv

e.g. for PO files (Maybe, If we look for if exists hooks related to PO files they could be already developed from another hook project, so use it instead):
 - duplicate-po-message-definition
 - po-msgstr-variables

So, IMHO in OCA we need to create a new project to push all these custom pre-commit hooks and add documentation of the useful projects replacing pylint-odoo checks.

The name proposal is oca/odoo-pre-commit-hooks similar to main hooks repository:

And we can (or not) enable the option to auto fix (we can even push checks without auto fix)

Check the following discussion about creating custom repository to detect and autofix:

Check the following discussion about deprecating duplicated checks if pre-commit supports:

Check the following plan to create a freeze branch in pylint-odoo with the current behavior in pro to create a new version with new focus and clean code, delete old unused checks, deprecate py2 and so on:

If you agree, Could you help us to create the repository in OCA, please?

Moisés López Calderón
Mobile: (+521) 477-752-22-30
Twitter: @moylop260
hangout: - Odoo Gold Partner
Twitter: @vauxoo

Post to:


Technology Services @
Business Solutions @
Enterprise Mobile Apps @ 
Quality Assurance @
Portal & DMS @

Jay Vora
Managing Director

Direct: +91-9879354457
Office: +91-9033472982
Skype: jaynvora
Twitter : jaynvora
Visit our website :