Metadata-Version: 2.4
Name: oca-odoo-pre-commit-hooks
Version: 0.2.29
Summary: odoo-pre-commit-hooks to use in pre-commit-config.yml files
Home-page: https://github.com/OCA/odoo-pre-commit-hooks
Author: Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: LGPL-3.0-or-later
Project-URL: Issue Tracker, https://github.com/OCA/odoo-pre-commit-hooks/issues
Keywords: pre-commit,OCA,Odoo Community Association,pre-commit-hook
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: colorama
Requires-Dist: fixit==2.2.1
Requires-Dist: lxml>=4.2.3
Requires-Dist: packaging
Requires-Dist: polib==1.2.*
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

[//]: # (start-badges)

[![Build Status](https://github.com/OCA/odoo-pre-commit-hooks/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/OCA/odoo-pre-commit-hooks/actions/workflows/test.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/OCA/odoo-pre-commit-hooks/branch/main/graph/badge.svg)](https://codecov.io/gh/OCA/odoo-pre-commit-hooks)
[![version](https://img.shields.io/pypi/v/oca-odoo-pre-commit-hooks.svg)](https://pypi.org/project/oca-odoo-pre-commit-hooks)
[![wheel](https://img.shields.io/pypi/wheel/oca-odoo-pre-commit-hooks.svg)](https://pypi.org/project/oca-odoo-pre-commit-hooks)
[![supported-versions](https://img.shields.io/pypi/pyversions/oca-odoo-pre-commit-hooks.svg)](https://pypi.org/project/oca-odoo-pre-commit-hooks)
[![commits-since](https://img.shields.io/github/commits-since/OCA/odoo-pre-commit-hooks/v0.2.29.svg)](https://github.com/OCA/odoo-pre-commit-hooks/compare/v0.2.29...main)
[![code-style-black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[//]: # (end-badges)

# 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 oca-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


```yaml
    - repo: https://github.com/OCA/odoo-pre-commit-hooks
        rev: v0.2.29
        hooks:
        - id: oca-checks-odoo-module
        - id: oca-checks-po
          args: ["--fix"]
```

# Usage directly the entry points

If you install directly the package use the entry point:

    oca-checks-odoo-module --help
    oca-checks-po --help


# Skip one xml-check for only one file

If you need to skip one check in one particular XML file you can use the follow comment

```xml
<?xml version="1.0" encoding="utf-8"?>
<!-- oca-hooks:disable=xml-check-to-skip -->
<odoo>
...
</odoo>
```

```xml
<?xml version="1.0" encoding="utf-8"?>
<!-- oca-hooks:disable=xml-check-to-skip,
                       xml-check-to-skip2 -->
<odoo>
...
</odoo>
```

The position of the comment it is not relative to the line that throw the check

It disable the entire file

# Configuration
Behavior can be configured through several methods and as of now only consists of enabling/disabling checks.

## Enabling or Disabling Checks
Each available hook consists of multiple checks which can be enabled/disabled using any of the following methods (ordered by priority):

1. As an argument e.g., `oca-checks-odoo --enable=check-to-enable --disable=check-to-disable1,check-to-disable2`
2. Using environment variables `OCA_HOOKS_ENABLE` or `OCA_HOOKS_DISABLE` e.g., `export OCA_HOOKS_ENABLE=check1,check2`
3. A configuration file. The path to it can be specified with the argument `--config`. Alternatively a file named `.oca_hooks.cfg`
will be looked for (by default) in the following locations (in order):
   1. Current working directory
   2. Repo's root
   3. User's home

### Using a Configuration File
To enable or disable checks using a configuration file, add a `disable` or `enable` key under the `MESSAGES_CONTROL` section.
For example:
```
[MESSAGES_CONTROL]
enable=check-enable1,check-enable2
disable=check-to-disable
```

To customize the `xml-tag-position` check, you can also define `xml_attributes_order` in the same section.
Each group declares equivalent attributes, and groups are enforced from left to right.

```
[MESSAGES_CONTROL]
xml_attributes_order=[t-if, t-else, t-elif], [id, t-att-id, t-attf-id], [class, t-att-class, t-attf-class]
```

Custom example:

```
[MESSAGES_CONTROL]
xml_attributes_order=[class], [id], [t-if]
```

The same value can also be passed from CLI with `--xml-attributes-order`.

As stated before, each source has a certain priority. This means that if the environment variable `OCA_HOOKS_ENABLE=check1`
exists, the configuration file above would not have any effect when it comes to enabling checks, and the only enabled
check will be `check1`.

However, if `OCA_HOOKS_DISABLE` is not set, the configuration file will still have an effect and `check-to-disable` will
be disabled.

[//]: # (start-checks)

# Checks

* Check weblate-component-too-long
Check if the component is too long
Weblate have 100 characters limit for repository name + Odoo Version + module name
e.g. The following module:
    https://github.com/OCA/account-financial-reporting/tree/18.0/account_tax_balance
Generates the following component:
    account-financial-reporting-18.0-account_tax_balance

* Check file-not-used
Check if there is a file created but not referenced from __manifest__.py

* Check manifest-syntax-error
Check if the manifest file has syntax error

* Check prefer-readme-rst
Check if the module has README.md file to prefer README.rst file

* Check use-header-comments
Check if the py file has comments '# comment' only in the header of python files
Except valid comments e.g. pylint, flake8, shebang or comments in the middle (not header)

* 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 scss-css-import

An `@import` of a stylesheet that is not part of the bundle: `@import url(...)`, an
`@import` of an `http(s)://` or `//` address, or of a `.css` file. (Any other `@import`
is a Sass partial that the compiler inlines, it costs nothing and is not reported.)

`@import url(...)` (and any `@import` inside a `.css` file) is left to the browser. The
browser does not know about the imported file until it has downloaded and parsed the one
that imports it, so the two downloads are chained one after the other instead of running
in parallel, and the page cannot paint before both end (GTmetrix: "Avoid CSS @import"
and "Avoid chaining critical requests"). When the address is another site, as
`fonts.googleapis.com`, it also costs a new connection (DNS, TCP and TLS), the
stylesheet has a short cache lifetime that you do not control, and every visitor is
revealed to a third party. Self-host instead: download the font files as `.woff2`,
declare the `@font-face` in the module with `font-display: swap` and delete the `@import`.

A quoted `@import "..."` of a `.css` file or of an address, in a `.scss` file, never
reaches the browser: Odoo removes the quoted imports whose path has a dot or starts with
`.`, `/` or `~`, and reports "Local import is forbidden for security reasons" among the
errors of the bundle. The file is not loaded at all. List it in the `assets` of the
manifest instead (`.css` files go in the bundle as they are), or self-host the font as
said above.

* Check scss-font-display-missing

A `@font-face` without `font-display`. The browser then uses `auto`, which in practice
is `block`: the text that uses the font stays invisible until the font arrives, up to
3 seconds, before it falls back (the "flash of invisible text"). That delays the First
and Largest Contentful Paint of every page that has text in that font (GTmetrix:
"Ensure text remains visible during webfont load").

`font-display: swap` paints the text at once with the fallback font and swaps it when the
font is ready. Prefer `optional` for a decorative font that may be skipped on a slow
connection, because it never moves the text (no layout shift). An icon font needs `block`:
while it downloads the browser must wait for it, because a fallback font paints the code
points of the icons as unrelated characters.

The stylesheets of the PDF report bundles are not reported: wkhtmltopdf does not paint the
text progressively, so `font-display` has no effect there.

The autofix adds `font-display: swap;` as the last declaration of the `@font-face`.

* Check scss-font-legacy-format

A `@font-face` serves its font as `.otf`, `.ttf`, `.eot` or `.woff` and no `.woff2`.
WOFF2 compresses the font with Brotli: the same font weighs about 50-70 % less than
the `.ttf`/`.otf` (an uncompressed container made for the desktop) and about 20-30 % less
than `.woff` (zlib). Every browser still supported reads it (Chrome 36, Firefox 39,
Safari 12, Edge 14), so no other format is needed as a fallback in a browser
(wkhtmltopdf does not read WOFF2, so the stylesheets of the report bundles are skipped).
With the default `font-display` the text stays invisible while the font downloads, so
its size shows in the First and Largest Contentful Paint
(GTmetrix: "Enormous network payloads").

To migrate a font keep its glyphs and convert only the container:
`pip install fonttools brotli && fonttools ttLib.woff2 compress Font.otf`
(or `woff2_compress Font.otf`), commit the new `.woff2`, point the `url()` to it with
`format("woff2")` and delete the old file. Convert `.eot` and `.svg` fonts from the
original `.ttf`/`.otf`.

Only the stylesheets that the manifest lists in `assets` are read: a Sass partial that is only
reached through an `@import`, a `.sass` or `.less` file is not.
The stylesheets of the PDF report bundles are not reported (the bundle is read from the
`assets` of the manifest: `web.report_assets_common`, `web.report_assets_pdf`,
`snailmail.report_assets_snailmail`...). wkhtmltopdf renders them with an old QtWebKit
that cannot read WOFF2, so their fonts must stay as `.ttf` or `.otf`.

The autofix rewrites the `url()` and its `format()` when the `.woff2` is already next
to the old file. It does not convert the font: the conversion is a binary file that
has to be reviewed and committed.

* Check xml-deprecated-data-node
Deprecated <data> node inside <odoo> xml node

* Check xml-deprecated-oe-chatter

Odoo 18 introduced a new XML tag `<chatter/>` which replaces the old way to declare
chatters on form views. For more information, see:
https://github.com/odoo/odoo/pull/156463

* Check xml-deprecated-openerp-node
deprecated <openerp> xml node

* Check xml-deprecated-qweb-directive
for use of deprecated QWeb directives t-*-options

* Check xml-deprecated-qweb-directive-15
t-esc and t-raw directives are deprecated in Odoo v15.0, use t-out instead.
For more details https://github.com/odoo/odoo/commit/01875541b1a8131cb and https://github.com/odoo/odoo/pull/70004

* Check xml-deprecated-res-groups-category-id

Odoo 19 removed the field `category_id` of `res.groups`. It was replaced by `privilege_id`,
a many2one to the new model `res.groups.privilege`, so a record still writing `category_id`
breaks the installation with
`ValueError: Invalid field 'category_id' on model 'res.groups'`.
The autofix removes the field, the very change Odoo applied to its own groups whose category
was only a technical one. Set `privilege_id` by hand instead when the group is meant to be
displayed under a privilege in the user form.
For more details https://github.com/odoo/odoo/commit/33637d137ed52f5faabaafd5c208e187042be8eb
and https://github.com/odoo/odoo/pull/199988

* Check xml-header-missing
Generated when the XML file is missing the XML declaration header '<?xml version="1.0" encoding="UTF-8" ?>'

* Check xml-header-wrong
Generated when the XML file declaration header is different than expected (case sensitive).

* Check xml-img-without-size

The `<img>` tag of a QWeb template has no `width` and `height` attributes.
The browser reserves no space for the picture until it arrives, so everything below it
moves when it does (Cumulative Layout Shift, reported by Lighthouse and GTmetrix as
"Use explicit width and height on image elements").
Use the intrinsic size of the image in pixels: with `img-fluid` or `height: auto` the
picture still scales down with its container, but the `width` attribute is the width
that it uses, so a smaller number than the real one shrinks the picture.
The dynamic forms `t-att-width`, `t-attf-width`, `t-att` and `t-att-style`, a `width` and
a `height` in the inline `style` and an inline `aspect-ratio` are accepted too.
Images of a `t-field` or `t-out` widget, whose tag is built by Odoo, and the QWeb views
declared in the `arch` of an `ir.ui.view` record are not seen here.

The picture is not reported where stating its size is useless or harmful:
* a PDF report or a mail: the template inherits or calls a report or mail layout
  (`web.external_layout*`, `web.html_container`, `mail.*`, `mass_mailing.*`), it is the
  template of an `ir.actions.report` of the module, or its file is in a `report/` directory
  or has `mail`, `mailing` or `digest` in its name
* content that the user replaces in the website builder: a picture with a fixed `src`
  inside a `data-snippet`, an `oe_structure`/`o_editable` zone, a snippet template (`s_*`)
  or a page template. A picture whose `src` is built by the template (`t-att-src`,
  `t-attf-src`: the logo of the website, the photo of a record) is still reported
* a size already fixed by the class (`o_image_64_cover`) or by `width` and `height` in the
  inline `style`, a picture out of the flow (`position-absolute`, `position: absolute`)
  and a pixel inside `<noscript>`
Anything else can be silenced with the usual comment of the file.

* Check xml-not-valid-char-link
The resource in in src/href contains a not valid character.

* Check xml-oe-structure-missing-id

Ensure all tags with class 'oe_structure' have an ID. For more information on the rationale, see:
https://github.com/OCA/odoo-pre-commit-hooks/issues/27

* 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-field-bool-without-eval

if the record is boolean but without eval attribute
`<field name="active">True</field>`
instead of
`<field name="active" eval="True" />`

* Check xml-field-numeric-without-eval

if the record is integer but without eval attribute
`<field name="sequence">100</field>`
instead of
`<field name="sequence" eval="100" />`

* Check xml-invisible-in-list-view

Using `invisible="1"` or `invisible="True"` on a `<field>` inside a `<list>` or `<tree>`
view does not hide the column properly.  Since Odoo 17 the correct attribute to hide an
entire column is `column_invisible="True"`.
For more details see https://www.odoo.com/documentation/17.0/developer/reference/backend/views.html#lists

Only the columns, the fields that are direct children of the `<list>` or `<tree>`, are
checked, so the ones added by an inherited view (`<xpath ... position="inside">`,
`<attribute name="invisible">`) are not reported. A field of a view declared inside a
field of the list (`<form>`, `<kanban>`, ...) or of a `<groupby>` is not reported either.

The autofix replaces `invisible="1"` and `invisible="True"` with `column_invisible="True"`.
The column is then removed as a whole: its header, its footer total and its export
are gone too, instead of only emptying the cell of each row.
It is skipped (the error is still reported) when the field already has `column_invisible`.

* 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-record-missing-id
Generated when a <record> tag has no id.

* 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

* Check xml-tag-position
Check the position of XML attributes.
The order is dynamically configurable via xml_attributes_order.

* Check xml-dangerous-qweb-replace-low-priority
Dangerous qweb view defined with low priority

* Check xml-duplicate-template-id
Triggered when two templates share the same ID

* Check xml-xpath-translatable-item check `xpath` nodes using `contains(text(), 'Text translatable')`
Since that the text could be translated so it is a mutable value.
It could raise `ValueError` exception if the language is changed.

** Special fixit checks

* Check field-string-redundant
Detects and removes the 'string' parameter in odoo.fields if it is redundant
(matches the field name in Title Case), ensuring it only applies to
Odoo Class definitions (Models).

* Check manifest-superfluous-key
Identifies and removes
Identifies from Odoo manifest files (__manifest__.py) superfluous keys
(if they have the same as the default value) should be omitted for simplicity

e.g. 'installable': True
`True` is the default value for installable key

e.g. 'data': []
`[]` is the default value for 'data' key

* Check prefer-env-translation
Replace `_('text')` with `self.env._('text')` only if '_' comes from 'odoo._'
and only for modules >=18.0

* Check unused-logger
Disallow unused `_logger = logging.getLogger(__name__)` in Odoo models.


[//]: # (end-checks)


[//]: # (start-checks-po)

# Checks PO

* 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

* Check po-duplicate-model-definition
Verify that no entries share the same 'model:' tag

* Check po-pretty-format
Check the following:
1. Entries sorted alphabetically
2. Lines are wrapped at 78 columns (same as Odoo)
3. Clear msgstr when it is the same as msgid

* Check po-syntax-error
Check syntax of PO files from i18n* folders


[//]: # (end-checks-po)


[//]: # (start-help)

# Help
```bash
usage: oca-checks-odoo-module [-h] [--no-verbose] [--no-exit] [--disable DISABLE] [--enable ENABLE] [--config CONFIG] [--list-msgs] [--fix] [--xml-attributes-order XML_ATTRIBUTES_ORDER] [files_or_modules ...]

positional arguments:
 files_or_modules Odoo __manifest__.py paths or Odoo module paths.

options:
 -h, --help show this help message and exit
 --no-verbose If enabled so disable verbose mode.
 --no-exit If enabled so it will not call exit.
 --disable, -d DISABLE Disable the checker with the given 'check-name', separated by commas.
 --enable, -e ENABLE Enable the checker with the given 'check-name', separated by commas. Default: All checks are enabled by default
 --config, -c CONFIG Path to a configuration file (default: .oca_hooks.cfg)
 --list-msgs List all currently enabled messages.
 --fix Automatically fix files when possible
 --xml-attributes-order XML_ATTRIBUTES_ORDER Define a group of XML attributes to order with priority, comma-separated values. Repeat this option to add multiple groups. Example: --xml-attributes-order=t-if,t-else --xml-attributes-order=id,t-att-id --xml-attributes-order=class

```

[//]: # (end-help)


[//]: # (start-help-po)

# Help PO
```bash
usage: oca-checks-po [-h] [--no-verbose] [--no-exit] [--disable DISABLE] [--enable ENABLE] [--config CONFIG] [--list-msgs] [--fix] [--xml-attributes-order XML_ATTRIBUTES_ORDER] [po_files ...]

positional arguments:
 po_files PO files.

options:
 -h, --help show this help message and exit
 --no-verbose If enabled so disable verbose mode.
 --no-exit If enabled so it will not call exit.
 --disable, -d DISABLE Disable the checker with the given 'check-name', separated by commas.
 --enable, -e ENABLE Enable the checker with the given 'check-name', separated by commas. Default: All checks are enabled by default
 --config, -c CONFIG Path to a configuration file (default: .oca_hooks.cfg)
 --list-msgs List all currently enabled messages.
 --fix Automatically fix files when possible
 --xml-attributes-order XML_ATTRIBUTES_ORDER Define a group of XML attributes to order with priority, comma-separated values. Repeat this option to add multiple groups. Example: --xml-attributes-order=t-if,t-else --xml-attributes-order=id,t-att-id --xml-attributes-order=class

```

[//]: # (end-help-po)


[//]: # (start-example)

# Examples


 * csv-duplicate-record-id

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/ir.model.access.csv#L5 Duplicate CSV record `access_account_account_type` broken_module/ir.model.access.csv:6

 * csv-syntax-error

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/syntax_err_module/ir.model.access.csv#L1 'utf-8' codec can't decode byte 0xf1 in position 47: invalid continuation byte

 * field-string-redundant

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/models/broken_model.py#L98 The 'string' attribute is redundant and should be removed. (has autofix) You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=field-string-redundant` or `# lint-ignore`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/models/broken_model.py#L130 The 'string' attribute is redundant and should be removed. (has autofix) You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=field-string-redundant` or `# lint-ignore`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/models/broken_model.py#L140 The 'string' attribute is redundant and should be removed. (has autofix) You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=field-string-redundant` or `# lint-ignore`

 * file-not-used

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/__openerp__.py#L1 File "broken_module/report/test_report.xml" is not referenced in the manifest. 🔴 If it is loaded from another source (e.g. a post_init_hook script), just add it under the section "oca_data_manual": ["report/test_report.xml",] to be considered. 🔵 Otherwise, you might want to remove it.

 * manifest-superfluous-key

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/__openerp__.py#L32 Delete empty values. You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=manifest-superfluous-key` or `# lint-ignore`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/__openerp__.py#L34 Delete empty values. You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=manifest-superfluous-key` or `# lint-ignore`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/woversion_module/__manifest__.py#L8 Delete empty values. You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=manifest-superfluous-key` or `# lint-ignore`

 * manifest-syntax-error

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/manifest_werror/__manifest__.py#L1 Manifest could not be loaded manifest malformed
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/woinit_module/__manifest__.py#L1 Manifest could not be loaded

 * prefer-env-translation

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/models/broken_model.py#L247 Use self.env._(...) instead of _(…) directly inside Odoo model methods. You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=prefer-env-translation` or `# lint-ignore`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/models/broken_model.py#L264 Use self.env._(...) instead of _(…) directly inside Odoo model methods. You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=prefer-env-translation` or `# lint-ignore`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/models/broken_model.py#L267 Use self.env._(...) instead of _(…) directly inside Odoo model methods. You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=prefer-env-translation` or `# lint-ignore`

 * prefer-readme-rst

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/README.md#L1 Prefer README.rst instead of README.md

 * scss-css-import

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/imports.scss#L2 CSS `@import` of `url('https://fonts.googleapis.com/css?family=Barlow:300,400,700&display=swap')` is resolved by the browser The imported file is only discovered after the importing one is downloaded, so both downloads are chained. Self-host the font as .woff2 with an @font-face or list the stylesheet in the `assets` of the manifest
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/imports.scss#L4 `@import` of `"//fonts.example.com/css/family.css"` is dropped by Odoo and never loaded Odoo removes the quoted @import whose path has a dot or starts with . / ~ ("Local import is forbidden"). List the file in the `assets` of the manifest or self-host the font as .woff2 with an @font-face
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/imports.scss#L6 `@import` of `"legacy.css"` is dropped by Odoo and never loaded Odoo removes the quoted @import whose path has a dot or starts with . / ~ ("Local import is forbidden"). List the file in the `assets` of the manifest or self-host the font as .woff2 with an @font-face

 * scss-font-display-missing

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/fonts.scss#L2 `@font-face` without `font-display` Without it the text stays invisible while the font downloads. Add `font-display: swap;` (`optional` for a decorative font, `block` for an icon font)
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/fonts.scss#L8 `@font-face` without `font-display` Without it the text stays invisible while the font downloads. Add `font-display: swap;` (`optional` for a decorative font, `block` for an icon font)
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/fonts.scss#L14 `@font-face` without `font-display` Without it the text stays invisible while the font downloads. Add `font-display: swap;` (`optional` for a decorative font, `block` for an icon font)

 * scss-font-legacy-format

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/fonts.scss#L4 `@font-face` serves its font as .otf and not as `.woff2` WOFF2 (Brotli) weighs about 50-70 % less than .ttf/.otf and 20-30 % less than .woff, and every supported browser reads it. Convert: `fonttools ttLib.woff2 compress Font.otf` (pip install fonttools brotli), then use `url("Font.woff2") format("woff2")` and delete the old file
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/static/src/scss/fonts.scss#L10 `@font-face` serves its font as .ttf and not as `.woff2` WOFF2 (Brotli) weighs about 50-70 % less than .ttf/.otf and 20-30 % less than .woff, and every supported browser reads it. Convert: `fonttools ttLib.woff2 compress Font.otf` (pip install fonttools brotli), then use `url("Font.woff2") format("woff2")` and delete the old file

 * unused-logger

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/models/model_inhe1.py#L17 Unused `_logger` is not allowed in Odoo models. Remove it if not used. You can disable this check by adding the following comment to the affected line or just above it `# lint-ignore=unused-logger` or `# lint-ignore`

 * use-header-comments

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/eleven_module/models.py#L9 Use of header comments in lines 3, 5, 6, 7, 9

 * weblate-component-too-long

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/syntax_err_module/__manifest__.py#L1 Repo Name + Odoo version + Module name is too long for weblate component 'big-big-big-big-big-big-big-big-big-big-big-big-big-big-big-big-big--00.0-syntax_err_module' size 91 is longer than 90 characters

 * xml-create-user-wo-reset-password

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/res_users.xml#L10 record res.users without `context="{'no_reset_password': True}"`

 * xml-dangerous-qweb-replace-low-priority

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1.xml#L4 Dangerous use of `replace` from view with priority 0 < 99 Only replace as a last resort. Try `position="attributes"`, `position="move"` or `t-if="False"` first
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1.xml#L7 Dangerous use of `replace` from view with priority 0 < 99 Only replace as a last resort. Try `position="attributes"`, `position="move"` or `t-if="False"` first
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1.xml#L18 Dangerous use of `replace` from view with priority 0 < 99 Only replace as a last resort. Try `position="attributes"`, `position="move"` or `t-if="False"` first

 * xml-deprecated-data-node

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/demo/duplicated_id_demo.xml#L3 Deprecated `<data>` node Use `<odoo>` instead of `<odoo><data>` or `<odoo noupdate="1">` instead of `<odoo><data noupdate="1">`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view.xml#L3 Deprecated `<data>` node Use `<odoo>` instead of `<odoo><data>` or `<odoo noupdate="1">` instead of `<odoo><data noupdate="1">`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L3 Deprecated `<data>` node Use `<odoo>` instead of `<odoo><data>` or `<odoo noupdate="1">` instead of `<odoo><data noupdate="1">`

 * xml-deprecated-oe-chatter

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/deprecated_chatter.xml#L6 Please replace old style chatters with the new tag <chatter/>.

 * xml-deprecated-openerp-node

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view.xml#L2 Deprecated `<openerp>` xml node Use `<odoo>` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L2 Deprecated `<openerp>` xml node Use `<odoo>` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/model_view.xml#L2 Deprecated `<openerp>` xml node Use `<odoo>` instead

 * xml-deprecated-qweb-directive

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/website_templates.xml#L7 Deprecated QWeb directive `t-esc-options`. Use `t-options` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/website_templates.xml#L26 Deprecated QWeb directive `t-field-options`. Use `t-options` instead

 * xml-deprecated-qweb-directive-15

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L6 Deprecated QWeb directive `t-esc`. Use `t-out` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L7 Deprecated QWeb directive `t-raw`. Use `t-out` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L15 Deprecated QWeb directive `t-esc`. Use `t-out` instead

 * xml-deprecated-res-groups-category-id

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo19_module/security/res_groups.xml#L6 Deprecated `<field name="category_id"` of `res.groups` removed in Odoo 19.0 Use `<field name="privilege_id" ref="..."` with a `res.groups.privilege` record instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo19_module/security/res_groups.xml#L12 Deprecated `<field name="category_id"` of `res.groups` removed in Odoo 19.0 Use `<field name="privilege_id" ref="..."` with a `res.groups.privilege` record instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo19_module/security/res_groups.xml#L15 Deprecated `<field name="category_id"` of `res.groups` removed in Odoo 19.0 Use `<field name="privilege_id" ref="..."` with a `res.groups.privilege` record instead

 * xml-deprecated-tree-attribute

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo.xml#L31 Deprecated "<tree string=..."
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo.xml#L42 Deprecated "<tree colors=..."
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo.xml#L53 Deprecated "<tree fonts=..."

 * xml-duplicate-fields

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L5 Duplicate xml field `name` broken_module/model_view_odoo2.xml:12
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L22 Duplicate xml field `model` broken_module/model_view_odoo2.xml:23
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L80 Duplicate xml field `arch` broken_module/model_view_odoo2.xml:83

 * xml-duplicate-record-id

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view.xml#L5 Duplicate xml record id `view_model_form` broken_module/model_view_odoo.xml:5 broken_module/model_view_odoo2.xml:4
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L5 Duplicate xml record id `view_model_form2` broken_module/model_view_odoo2.xml:16

 * xml-duplicate-template-id

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1.xml#L3 Duplicate xml template id `qweb/my_template1_noupdate_0` broken_module/template1_copy2.xml:3
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1.xml#L10 Duplicate xml template id `qweb/my_template2_noupdate_0` broken_module/template1_copy2.xml:10
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1.xml#L17 Duplicate xml template id `qweb/my_template3_noupdate_0` broken_module/template1_copy2.xml:17

 * xml-field-bool-without-eval

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/demo/duplicated_id_demo.xml#L18 Field `active` with boolean value without `eval` attribute
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L18 Field `active` with boolean value without `eval` attribute

 * xml-field-numeric-without-eval

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/demo/duplicated_id_demo.xml#L8 Field `priority` with numeric value without `eval` attribute
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/demo/duplicated_id_demo.xml#L22 Field `sequence` with numeric value without `eval` attribute
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L62 Field `priority` with numeric value without `eval` attribute

 * xml-header-missing

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L1 XML missing header
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/xml_wo_header.xml#L1 XML missing header

 * xml-header-wrong

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/demo/duplicated_id_demo.xml#L1 XML header expected '<?xml version="1.0" encoding="UTF-8" ?>' but received '<?xml version="1.0" encoding="utf-8"?>'
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/deprecated_disable.xml#L1 XML header expected '<?xml version="1.0" encoding="UTF-8" ?>' but received '<?xml version="1.0" encoding="utf-8" ?>'
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view.xml#L1 XML header expected '<?xml version="1.0" encoding="UTF-8" ?>' but received '<?xml version="1.0" encoding="utf-8"?>'

 * xml-img-without-size

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/img_without_size.xml#L6 `<img>` without explicit width and height Set `width` and `height` to the intrinsic size of the image in pixels (`img-fluid` still scales it down) to avoid layout shifts while the image loads
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/img_without_size.xml#L8 `<img>` without explicit height Set `width` and `height` to the intrinsic size of the image in pixels (`img-fluid` still scales it down) to avoid layout shifts while the image loads
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/img_without_size.xml#L59 `<img>` without explicit width and height Set `width` and `height` to the intrinsic size of the image in pixels (`img-fluid` still scales it down) to avoid layout shifts while the image loads

 * xml-invisible-in-list-view

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo18_module/views/invisible_in_list.xml#L11 Use `column_invisible="True"` instead of `invisible` for field `state` inside a list/tree view `invisible` in a list hides the cell per-row; `column_invisible` hides the whole column
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo19_module/views/invisible_in_list.xml#L11 Use `column_invisible="True"` instead of `invisible` for field `state` inside a list/tree view `invisible` in a list hides the cell per-row; `column_invisible` hides the whole column
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/odoo19_module/views/invisible_in_list.xml#L23 Use `column_invisible="True"` instead of `invisible` for field `active` inside a list/tree view `invisible` in a list hides the cell per-row; `column_invisible` hides the whole column

 * xml-not-valid-char-link

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/website_templates.xml#L48 The resource in in src/href contains a not valid character
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/website_templates.xml#L50 The resource in in src/href contains a not valid character

 * xml-oe-structure-missing-id

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/website_templates.xml#L9 Consider removing the class `oe_structure` or adding a proper id to the tag. The id must contain `oe_structure`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/website_templates.xml#L13 Consider removing the class `oe_structure` or adding a proper id to the tag. The id must contain `oe_structure`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/website_templates.xml#L30 Consider removing the class `oe_structure` or adding a proper id to the tag. The id must contain `oe_structure`

 * xml-record-missing-id

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view.xml#L25 Record has no id, add a unique one to create a new record, use an existing one to update it
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view.xml#L28 Record has no id, add a unique one to create a new record, use an existing one to update it

 * xml-redundant-module-name

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L15 Redundant module name `<record id="broken_module.view_model_form2"` Use `<record id="view_model_form2"` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L158 Redundant module name `<menuitem id="broken_module.menu_root"` Use `<menuitem id="menu_root"` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L165 Redundant module name `<menuitem id="broken_module.menu_root2"` Use `<menuitem id="menu_root2"` instead

 * xml-syntax-error

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/file_no_exist.xml#L1 [Errno 2] No such file or directory: ''
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/file_no_exist.xml#L1 [Errno 2] No such file or directory: ''

 * xml-tag-position

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/deprecated_disable.xml#L4 The expected attributes order is `<record id="duplicate_record" ...>` Use `<record id="duplicate_record" ...>` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L43 The expected attributes order is `<record id="view_ir_config_search" ...>` Use `<record id="view_ir_config_search" ...>` instead
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view_odoo2.xml#L68 The expected attributes order is `<record id="access_rule" ...>` Use `<record id="access_rule" ...>` instead

 * xml-view-dangerous-replace-low-priority

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L25 Dangerous use of `replace` from view with priority 0 < 99 Only replace as a last resort. Try `position="attributes"`, `position="move"` or `invisible="1"` first
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L37 Dangerous use of `replace` from view with priority 0 < 99 Only replace as a last resort. Try `position="attributes"`, `position="move"` or `invisible="1"` first
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view2.xml#L47 Dangerous use of `replace` from view with priority 0 < 99 Only replace as a last resort. Try `position="attributes"`, `position="move"` or `invisible="1"` first

 * xml-xpath-translatable-item

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/model_view.xml#L11 Use of translatable xpath `text()`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1.xml#L39 Use of translatable xpath `text()`
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/template1_copy.xml#L31 Use of translatable xpath `text()`

[//]: # (end-example)


[//]: # (start-example-po)

# Examples PO


 * po-duplicate-message-definition

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L17 Duplicate PO message definition `Branch` in lines 23, 29. Odoo exports these items by msgid and delete one of them. Use the `i18n_extra` folder instead of `i18n` to ignore this message.
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L35 Duplicate PO message definition `Message id toooooooooooooooooooooooooooo...` in lines 41. Odoo exports these items by msgid and delete one of them. Use the `i18n_extra` folder instead of `i18n` to ignore this message.
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L65 Duplicate PO message definition `One variable {variable1}` in lines 71. Odoo exports these items by msgid and delete one of them. Use the `i18n_extra` folder instead of `i18n` to ignore this message.

 * po-duplicate-model-definition

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L17 Translation for model:ir.model.fields,field_description:broken_module.field_wizard_description has been defined more than once in line(s) 29
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L35 Translation for model:ir.model.fields,field_description2:broken_module.field_wizard_description2 has been defined more than once in line(s) 41
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L59 Translation for model:ir.model.fields,field_description5:broken_module.field_wizard_description5 has been defined more than once in line(s) 65
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/i18n/fr.po#L24 Translation for model:ir.model.fields,field_description2:test_module.field_description2 has been defined more than once in line(s) 24
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/i18n/fr.po#L31 Translation for model:ir.model.fields,field_description5:test_module.field_description5 has been defined more than once in line(s) 31
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/i18n/fr.po#L38 Translation for model:ir.model.fields,field_description3:test_module.field_description3 has been defined more than once in line(s) 38
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/i18n/fr.po#L45 Translation for model:ir.model.fields,field_description4:test_module.field_description4 has been defined more than once in line(s) 45

 * po-pretty-format

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/ar_unicode.po Wrong formatting
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/broken_module.pot Wrong formatting
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po Wrong formatting
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/xml_semi_empty.po Wrong formatting
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/eleven_module/i18n/ugly.po Wrong formatting
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/test_module/i18n/fr.po Wrong formatting

 * po-python-parse-format

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L53 Translation string couldn't be parsed correctly using str.format IndexError('Replacement index 1 out of range for positional args tuple')
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L59 Translation string couldn't be parsed correctly using str.format IndexError('Replacement index 1 out of range for positional args tuple')
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L65 Translation string couldn't be parsed correctly using str.format KeyError('variable2')
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L71 Translation string couldn't be parsed correctly using str.format KeyError('variable2')

 * po-python-parse-printf

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L47 Translation string couldn't be parsed correctly using str%variables TypeError('not all arguments converted during string formatting')
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/es.po#L83 Translation string couldn't be parsed correctly using str%variables TypeError('%d format: a real number is required, not str')

 * po-requires-module

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module/i18n/broken_module.pot#L14 Translation entry requires comment `#. module: MODULE`

 * po-syntax-error

    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/broken_module2/i18n/en.po#L1 Syntax error in po file
    - https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.29/test_repo/syntax_err_module/i18n/es.po#L19 Syntax error in po file

[//]: # (end-example-po)

## Licenses

This repository is licensed under [AGPL-3.0](LICENSE).

----
OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit
organization whose mission is to support the collaborative development of Odoo features
and promote its widespread use.

CHANGES
=======

v0.2.29
-------

* [ADD] checks\_odoo\_module\_scss: new scss-css-import check
* [ADD] checks\_odoo\_module\_scss: new scss-font-display-missing check with autofix
* [ADD] checks\_odoo\_module\_scss: new scss-font-legacy-format check with autofix (#205)
* [ADD] checks\_odoo\_module\_xml: new xml-img-without-size check (#204)

v0.2.28
-------

* [ADD] checks\_odoo\_module\_xml: new xml-invisible-in-list-view check with autofix for v17+ (#203)

v0.2.27
-------

* [ADD] xml-deprecated-res-groups-category-id: New check with autofix for v19.0+ (#200)

v0.2.26
-------

* [REM] xml-template-prettier-incompatible: Remove check

v0.2.25
-------

* [FIX] coveragerc: force core=ctrace for dynamic contexts on Python 3.14+
* [IMP] utils: avoid git subprocess and cache top\_path/walk\_up results
* [IMP] fixit: Disable nested parallelism under pre-commit to run ~5x faster
* [IMP] ci: add Python 3.15-dev and refresh tooling (#195)

v0.2.24
-------

* [ADD] xml-tag-position: enforce id, t-if/t-else/t-elif and class positioning attribute rules (#190)

v0.2.23
-------

* [REF] .coveragerc: Reduce to 90% the fail-coverage
* [REM] xml-double-quotes-py: Remove check since that it left &quot;

v0.2.22
-------

* [FIX] xml-double-quotes-py: fix tag detection and report exact attribute line (#188)

v0.2.21
-------

* [FIX] checks\_odoo\_module\_xml: return bytes from \_get\_first\_tag
* [FIX] test: Fix tmp dir for win
* fix xml-double-quotes-py
* [FIX] xml-id-position-first: preserve XML formatting during attr reordering
* [FIX] xml-deprecated-qweb-directive-15: preserve XML formatting during autofix
* [REF] tests: Add new corner case

v0.2.20
-------

* [REF] pre-commit-hooks: Use better description of the hook (#180)

v0.2.19
-------

* [REF] test: Add test for xml-deprecated-qweb-directive-15 check (#179)
* [IMP] checks\_odoo\_module\_xml: Add NodeContent class and improve the comment lines (#176)
* [ADD] xml-double-quotes-py: Detect XML attributes containing escaped double quotes " -> (&quot;) (#178)

v0.2.18
-------

* [REF] coveragerc: Relax 'fail under' parameter since that coveralls cover all the tests together insteaad of individual
* [ADD] weblate-component-too-long: Check if the weblate component name is too long

v0.2.17
-------

* [ADD] xml-deprecated-qweb-directive-15: t-esc and t-raw directives are deprecated in Odoo v15.0, use t-out instead (#174)

v0.2.16
-------

* [REF] field-string-redundant: Skip related fields in the check (#173)

v0.2.15
-------

* [ADD] field-string-redundant: Add old pylint known check but with autofix (#172)
* [REF] tox, github: Enable tox env 'multi' to run multiple jobs (#171)

v0.2.14
-------

* [REF] test\_profiling: Enable profiling from pytest
* [REF] checks\_odoo\_module\_fixit: Use pathlib instead of os.path
* [FIX] fixit: Use the correct disable comment (#168)
* [REF] tests: Migrating unittest to pytest (#167)
* [REF] prefer-env-translation: Consider static method case (#165)
* [REF] prefer-env-translation: Consider new test cases (#164)

v0.2.13
-------

* [REF] checks\_odoo\_module\_fixit: Use a separated entrypoint to be called from pre\_commit with parallels (#163)
* [IMP] prefer-env-translation: Now supports multiple calls in the same line (#162)

v0.2.12
-------

* [FIX] prefer-env-translation: Skip check if it is not Odoo's class (#161)

v0.2.11
-------

* [FIX] use-header-comments: Remove extra newline (#160)
* [REF] readme: Use whole original message (#159)

v0.2.10
-------

* [REF] use-header-comments: Skip fully commented files to avoid deletion (#158)

v0.2.9
------

* [ADD] use-header-comments: New check to remove comments in the py headers (#157)
* [REF] fixit: If the environment variable FIXIT\_ODOO\_VERSION is defined so it is used (#154)
* [REF] checks\_odoo\_module\_xml: Use filename\_short instead of full path (#156)

v0.2.8
------

* [REF] requirements: Use fixit from pypi after recent release (#155)

v0.2.7
------

* [ADD] unused-logger: Add new check for unused \_logger with autofix (#153)

v0.2.6
------

* [ADD] xml-template-prettier-incompatible: Add new check for xml template node incompatible with prettier autofixes (#150)
* [REF] github-actions: Enable py3.14 stable and use to build, lint and update-readme (#152)
* [IMP] xml-id-position-first: Consider 'template' tag (#151)

v0.2.5
------

* [ADD] xml-field-bool-without-eval, xml-field-numeric-without-eval: Check for bool or numeric fields without eval in xml records (#147)

v0.2.4
------

* [FIX] file-not-used: Skip check for non-installable modules
* [ADD] prefer-readme-rst: Add new check to prefer README.rst over README.md

v0.2.3
------

* [REF] github: The macOS-13 based runner images are now retired. (#146)
* [REF] checks\_odoo\_module\_xml: Support auto-fixing multiline attributes (#145)

v0.2.2
------

* [REF] manifest-superfluous-key: Consider boolean keys are \`False\` by default (#144)
* [REF] checks\_odoo\_module\_xml: Add the tag to be replace at fine grane (#143)

v0.2.1
------

* [REF] xml-redundant-module-name: Add autofix
* [ADD] xml-id-position-first: Add check to detect when xml id is not the first attribute

v0.2.0
------

* [ADD] prefer-env-translation, manifest-superfluous-key: Add new checks with autofix using fixit library (#141)

v0.1.8
------

* [ADD] xml-header-missing, xml-header-wrong: Add new XML checks with autofix (#140)

v0.1.7
------

* [REM] xml-dangerous-filter-wo-user: Remove outdated check for dangerous filters without user (#139)
* [REF] \*: Small fixes (#137)

v0.1.6
------

* [REF] requirements.txt: Update polib (#134)

v0.1.5
------

* [REF] global\_parser: FileType is deprecated for py3.14
* [REF] github-actions: Use py3.14-dev
* [REF] github-actions: Add codecov token to fix upload coverage (#131)

v0.1.4
------

* [REF] file-not-used: Skip option using "oca\_data\_manual" in the manifest file (#130)

v0.1.3
------

* [FIX] requirements.txt: Add missing 'packaging' requirement (#129)

v0.1.2
------

* [ADD] file-not-used: Detects files not used from manifest (#127)
* [FIX] utils: Fix "TypeError: expected string or bytes-like object, got 'NoneType'" (#128)
* [ADD] xml-deprecated-oe-chatter: Check for deprecated chatter for odoo v18.0+ (#125)

v0.1.1
------

* [REF] po-duplicate-message-definition: Ignore i18n\_extra folder (#123)

v0.1.0
------

* [REF] checks\_odoo\_module\_po: Remove special char incompatible with windows codecs (#117)
* [REF] README: Update readme with new py3.13 version
* [REF] setup.py: Deprecate py3.8-

v0.0.35
-------

* [FIX] po-pretty-format: Allow original=translated term  for "i18n\_extra" folder (#113)

v0.0.34
-------

* [IMP] \*: Display the duplicated lines (#111)
* [REF] tox.ini: Add compatibility with new pyttest (#112)
* [IMP] csv-duplicate-record-id: show the actual record id
* [IMP] xml-duplicate-record-id: show the actual record id

v0.0.33
-------

* [IMP] check\_odoo\_module\_po: extract line number from error message (#108)
* [IMP] Better error output (#106)

v0.0.32
-------

* [FIX] unwanted execution of globally disabled checks (#105)
* [REF] github-actions: Use exclude macosx-latest for py old (#104)
* [REF] github-actions: Add arch in cache-key to use macosx m1 and intel compatibility (#103)
* [REF] setup: Add setuptools deps to build Related to https://github.com/pypa/build/issues/98
* [REF] github-actions: Use macosx-latest only for py-latest and macosx-14 for older Related to https://github.com/actions/setup-python/issues/825\#issuecomment-2096792396

v0.0.31
-------

* [REF] setup: Add py3.12 support info (#98)
* [REF] .github: Update actions version, fix cache and update lints (#97)
* [REF] tests: Fixing windows po autofix unitest (#96)

v0.0.30
-------

* CI improvements (#93)
* [REF] setup: Enable py311 classifier (#87)

v0.0.29
-------

* IMP] add xml-duplicate-template-id message (#82)
* [FIX] lints (#86)
* [ADD] po-duplicate-model-definition check (#85)
* [REF] Don't filter out messages, move is\_message\_enabled (#83)
* [IMP] add xml-record-missing-id (#84)

v0.0.28
-------

* [FIX] oe-structure-missing-id: change constraints, add docs (#81)

v0.0.27
-------

* [REF] improve xpath expressions (#80)

v0.0.26
-------

* [IMP] Improve XPath expressions, compile them only once, fix false negative, add profiling tests (#79)
* [ADD] pretty-format-po check (#76)
* [IMP] add xml-oe-structure-missing-id check (#78)
* [REF] tests: Generate immutable readme (without extra spaces)
* [IMP] README: Added a section on configuration

v0.0.25
-------

* [REF] requirements.txt: Update polib to fix issues and improves (#72)

v0.0.24
-------

* [FIX] pre-commit: Fix isort hook - RuntimeError The Poetry configuration is invalid (#71)

v0.0.23
-------

* [FIX] Correct documentation (#69)

v0.0.22
-------

* [IMP] Help msg for "xml-view-dangerous-replace-low-priority" (#68)
* Wrote documentation for proposed refactoring (#66)
* [FIX] ci: update flake8 repo URL, tox.ini and gh actions .yml (#65)
* [REF] hooks: Add support for \`<!-- pylint:disable=CHECK -->\` (#62)

v0.0.21
-------

* [REF] duplicate-xml-fields: Only applies to direct record's children (#58)

v0.0.20
-------

* [FIX] xml-xpath-translatable-item: Fix false negative calling a method o.amount\_to\_text() (#57)

v0.0.19
-------

* [FIX] setup: Add missing "requirements.txt" file to package (#441) (#55)

v0.0.18
-------

* [FIX] checks\_odoo\_module: Support glob expression for "qweb" manifest data section (#54)
* [IMP] oca\_pre\_commit\_hooks: Add --list-msgs option (#53)
* [REF] oca\_pre\_commit\_hooks: Silent subprocess git error (#52)

v0.0.17
-------

* [IMP] oca\_pre\_commit\_hooks: Support enable/disable from ENV (#38) (#49)

v0.0.16
-------

* [ADD] xml-xpath-translatable-item: Add new check to identify mutable item used from xpath (#50)

v0.0.15
-------

* [FIX] oca\_pre\_commit\_hooks: Fix exit\_status false error (#48)

v0.0.14
-------

* [IMP] oca\_pre\_commit\_hooks: Support for config file (#41)

v0.0.13
-------

* [REF] pylint\_odoo: Remove TODO comments (#47)
* [REF] requirements: Remove unused libraries and pre-commit hooks (#45)
* [REF] xml-deprecated-data-node: Use the data node sourceline instead of odoo node (#43)
* [IMP] oca\_pre\_commit\_hooks: Support disable XML checks from disable comments (#42)
* [REF] README: Fix name of pypi package (#35)
* [REF] oca\_pre\_commit\_hooks: cli\_po, cli: Add cli\_po and cli global (#36)
* [REF] setup: Match requires-python = ">=3.7" from pre-commit
* [REF] CI: Enable py3.11

v0.0.12
-------

* [REF] checks\_odoo\_module\_xml: Allow duplicated fields with 'groups' (#32)
* [REF] CI: Enable tox with parallels + codecov compatibility (#33)

v0.0.11
-------

* [REF] codecov: Enable codecov again
* [REM] missing-readme: Check add to pylint-odoo
* [REF] TOX: Strip names, remove no-cover, compatible with parallels option (#24)
* [REF] lint: Adapt lints for py packages instead of odoo module (#23)

v0.0.10
-------

* [REF] README: Update README and fix mutable results auto-generating it (#22)
* [REF] checks\_odoo\_module\_po: Run on modified PO files only (#21)
* [REF] manifest: Skip duplicated data files (#20)

v0.0.9
------

* [FIX] README: Fix regex to replace autogenerated content (#18)
* [REF] README: Detect from CI if README needs to be updated (#17)

v0.0.8
------

* [REF] README: Add examples of checks section and script to auto-generate it (#16)
* [REF] README: Add help section and script to auto-generate it (#15)

v0.0.7
------

* [REF] checks: name\_checks changed to name-checks (#14)
* [REF] oca\_pre\_commit\_hooks: Use shorter path in messages (#13)
* [FIX] pre-commit-hooks.yaml: Run checks even if the manifest was not changed
* [REF] test: Remove TODO comments already fixed

v0.0.6
------

* [FIX] oca\_pre\_commit\_hooks: Fix checks if it has syntax error (#8)

v0.0.5
------

* [REF] oca\_pre\_commit\_hooks: Small improvements (#7)

v0.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
------

* [REF] README: Remove deprecated CI build

v0.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
