Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: l10n-estonia status and proposing myself as PSC
Re: l10n-estonia status and proposing myself as PSC
New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
by
Vauxoo, Moisés López Calderón
Currently, we are using pylint-odoo project as pre-commit hooks for other kind of files
- create-user-wo-reset-password
- duplicate-xml-fields
- redundant-modulename-xml
- deprecated-data-xml-node
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
e.g. eslint see https://github.com/pre-commit/mirrors-eslint
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-variablesSo, 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
Twitter: @vauxoo
Follow-Ups
-
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
byAcsone SA/NV, Stéphane Bidoul -
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
byAcsone SA/NV, Stéphane Bidoul -
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
byModuon Team, S. L., Jairo Llopis -
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
byAcsone SA/NV, Denis Roussel -
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
byClosingAp Open Source Integrators Europe, LDA, Daniel Reis -
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
byAcsone SA/NV, Laurent Mignon -
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
byTecnativa. S. L., Pedro M. Baeza -
Re: New repository oca/odoo-pre-commit-hooks and pylint-odoo deep refactoring
bySerpent Consulting Services, Jay Vora