odoo-pre-commit-hooks
OCA's custom pre-commit hooks for Odoo modules
Installation
You don't need to install it directly only configure your ".pre-commit-config.yaml" file
You even can install it directly:
- Installing from pypi:
- pip install -U odoo-pre-commit-hooks
- Installing from github:
- pip install --force-reinstall -U git+https://github.com/OCA/odoo-pre-commit-hooks.git@main
Usage pre-commit-config.yaml
Add to your ".pre-commit-config.yaml" configuration file the following input
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.6
hooks:
- id: oca-checks-odoo-module
Usage using directly the entry points
If you install directly the package use the entry point:
oca-checks-odoo-module --help
Checks
-
Check manifest_syntax_error Check if the manifest file has syntax error
-
Check missing_readme Check if a README file is missing
-
Check csv_duplicate_record_id duplicate CSV "id" AKA xmlid but for CSV files
-
Check csv_syntax_error Check syntax error for CSV files declared in the manifest
-
Check po_requires_module Translation entry requires comment '#. module: MODULE'
-
Check po_python_parse_printf Check if 'msgid' is using 'str' variables like '%s' So translation 'msgstr' must be the same number of variables too
-
Check po_python_parse_format Check if 'msgid' is using 'str' variables like '{}' So translation 'msgstr' must be the same number of variables too
-
Check po_duplicate_message_definition (message-id) in all entries of PO files
We are not using `check_for_duplicates` parameter of polib.pofile method e.g. polib.pofile(..., check_for_duplicates=True) Because the output is: raise ValueError('Entry "%s" already exists' % entry.msgid) It doesn't show the number of lines duplicated and it shows the entire string of the message_id without truncating it or replacing newlines -
Check po_syntax_error Check syntax of PO files from i18n* folders
-
Check xml_redundant_module_name
If the module is called "module_a" and the xmlid is <record id="module_a.xmlid_name1" ... The "module_a." is redundant it could be replaced to only <record id="xmlid_name1" ... -
Check xml_dangerous_filter_wo_user Check dangerous filter without a user assigned.
-
Check xml_create_user_wo_reset_password records of user without context="{'no_reset_password': True}" This context avoid send email and mail log warning
-
Check xml_view_dangerous_replace_low_priority in ir.ui.view
<field name="priority" eval="10"/> ... <field name="name" position="replace"/> -
Check xml_deprecated_tree_attribute The tree-view declaration is using a deprecated attribute.
-
Check xml_dangerous_qweb_replace_low_priority Dangerous qweb view defined with low priority
-
Check xml_deprecated_data_node Deprecated node inside xml node
-
Check xml_deprecated_openerp_xml_node deprecated xml node
-
Check xml_deprecated_qweb_directive for use of deprecated QWeb directives t-*-options
-
Check xml_not_valid_char_link The resource in in src/href contains a not valid character.
-
Check xml_duplicate_record_id
If a module has duplicated record_id AKA xml_ids file1.xml <record id="xmlid_name1" file2.xml <record id="xmlid_name1" -
Check xml_duplicate_fields in all record nodes <record id="xmlid_name1"... <field name="field_name1"... <field name="field_name1"...
-
Check xml_syntax_error Check syntax of XML files declared in the Odoo manifest
Licenses
This repository is licensed under AGPL-3.0.
However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA)
policy. Consult each module's __manifest__.py file, which contains a license key
that explains its license.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
CHANGES
v0.0.6
- Bump version: 0.0.5 → 0.0.6
- [FIX] oca_pre_commit_hooks: Fix checks if it has syntax error (#8)
v0.0.5
- Bump version: 0.0.4 → 0.0.5
- [REF] oca_pre_commit_hooks: Small improvements (#7)
v0.0.4
- Bump version: 0.0.3 → 0.0.4
- [IMP] oca_pre_commit_hooks: Enable feature to 'enable' checks (#6)
- [IMP] oca_pre_commit_hooks: Add entrypoint arguments to disable checks (#5)
v0.0.3
- Bump version: 0.0.2 → 0.0.3
- [REF] README: Remove deprecated CI build
v0.0.2
- Bump version: 0.0.1 → 0.0.2
- [REF] CI: Re-use tox to run pre-commit in the CI with same caches and packages
- [ADD] .pre-commit-hooks.yaml: Compatible with pre-commit-hooks to use as hook id directly
v0.0.1
- [ADD] Migrate pylint-odoo checks (not related to python) to pre-commit hooks (#2)
- Initialize
Metadata
Release files for oca-odoo-pre-commit-hooks 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oca-odoo-pre-commit-hooks-0.0.6.tar.gz | 26.5 kB | Without provenance | Details for oca-odoo-pre-commit-hooks-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oca_odoo_pre_commit_hooks-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for oca_odoo_pre_commit_hooks-0.0.6-py3-none-any.whl |
Total release size: 55.4 kB
Release files / oca-odoo-pre-commit-hooks-0.0.6.tar.gz
| Download URL | oca-odoo-pre-commit-hooks-0.0.6.tar.gz |
|---|---|
| Size | 26.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c95498b57c32a2bcdc4915b0ad597b4952ad7f185bdee711274356ebf14798c
|
|
BLAKE2b-256 checksum How to use checksums |
c6ef6197d9c6097fb2c5e1788b86272c8cf3b77cb8bf28cd9de921d6fbd1a376
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.7
|
Release files / oca_odoo_pre_commit_hooks-0.0.6-py3-none-any.whl
| Download URL | oca_odoo_pre_commit_hooks-0.0.6-py3-none-any.whl |
|---|---|
| Size | 28.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6a8baf842d835d8127366df0331a34609a3fc825f135c6ed44d87fa6922daa6
|
|
BLAKE2b-256 checksum How to use checksums |
da0cc66fb81bfaf359abc3e59628e069d47ebbdf82f37a11ed5e690c421eb080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.7
|
Security for oca-odoo-pre-commit-hooks 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.