Skip to content

Commit

Permalink
[ADD] Pre-commit compatibility for odoo < 13
Browse files Browse the repository at this point in the history
  • Loading branch information
josep-tecnativa committed Oct 21, 2024
1 parent f3df4ad commit 32d5c7d
Show file tree
Hide file tree
Showing 7 changed files with 373 additions and 38 deletions.
47 changes: 46 additions & 1 deletion .pylintrc-mandatory.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,51 @@ valid-odoo-versions={{ odoo_version }}
[MESSAGES CONTROL]
disable=all


{% if odoo_version < 11 %}
enable=anomalous-backslash-in-string,
# api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
manifest-author-string,
manifest-deprecated-key,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
# translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error
{%- else %}
enable=attribute-deprecated,
manifest-author-string,
manifest-deprecated-key,
Expand Down Expand Up @@ -87,6 +131,7 @@ enable=attribute-deprecated,
translation-too-many-args,
translation-unsupported-format
{%- endif %}
{%- endif %}

[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
Expand Down
65 changes: 65 additions & 0 deletions .pylintrc.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,70 @@ disable=all
# config as a blocking check.

# messages that do not cause the lint step to fail
{%- if odoo_version < 11%}
enable=anomalous-backslash-in-string,
# api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
{%- if project_author %}
manifest-required-author,
{%- endif %}
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
# translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
create-user-wo-reset-password,
dangerous-filter-wo-user,
deprecated-module,
file-not-used,
invalid-commit,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
redefined-builtin,
too-complex,
unnecessary-utf8-coding-comment
{%- else %}
enable=attribute-deprecated,
consider-merging-classes-inherited,
invalid-commit,
Expand Down Expand Up @@ -120,6 +184,7 @@ enable=attribute-deprecated,
translation-unsupported-format,
website-manifest-key-not-valid-uri
{%- endif %}
{%- endif %}

[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
Expand Down
84 changes: 84 additions & 0 deletions {% if odoo_version <= 12 %}.module-readme.rst.j2{% endif %}.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{% raw -%}
{%- macro fragment(name, title, sub='=') %}
{%- if name in fragments %}
{{- title }}
{{ sub * title|length }}

{{ fragments[name] }}
{% endif %}
{%- endmacro -%}

{{ '=' * manifest.name|length }}
{{ manifest.name }}
{{ '=' * manifest.name|length }}

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge_devstat| image:: https://img.shields.io/badge/maturity-{{ development_status | replace("-", "--") | urlencode }}-brightgreen.png
:target: https://odoo-community.org/page/development-status
:alt: {{ development_status | title }}

.. |badge_license| image:: https://img.shields.io/badge/license-{{ manifest.license | d("Unknown") | replace("-", "--") | urlencode }}-blue.png
:alt: {{ manifest.license | d("Unknown") }}

|badge_devstat| |badge_license|

{{ fragments.get('DESCRIPTION', '') }}
{% if development_status == 'alpha' -%}

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

{% endif -%}

**Table of contents**

.. contents::
:local:

{{ fragment('INSTALL', 'Installation') }}
{{- fragment('CONFIGURE', 'Configuration') }}
{{- fragment('USAGE', 'Usage') }}
{{- fragment('DEVELOP', 'Development') }}
{{- fragment('ROADMAP', 'Known issues / Roadmap') -}}
{{- fragment('HISTORY', 'Changelog') -}}

Credits
{{ "=======" }}

{% if authors -%}
Authors
~~~~~~~

{% for author in authors if author -%}
* {{ author }}
{% endfor %}
{% endif -%}

{{ fragment('CONTRIBUTORS', 'Contributors', sub='~') }}
{{- fragment('CREDITS', 'Other credits', sub='~') -}}
Maintainers
~~~~~~~~~~~

This module is maintained by {{ org_name }}.

Contact the maintainer through their official support channels in case you find
any issues with this module.
{% if manifest.maintainers %}

{% for maintainer in manifest.maintainers %}
.. |maintainer-{{ maintainer }}| image:: https://github.com/{{ maintainer }}.png?size=40px
:target: https://github.com/{{ maintainer }}
:alt: {{ maintainer}}
{%- endfor %}

Current maintainer{% if manifest.maintainers|length > 1 %}s{% endif %}:

{% for maintainer in manifest.maintainers %}|maintainer-{{ maintainer }}|{% if not loop.last %} {% endif %}{% endfor %}
{% endif %}
{% endraw -%}
Loading

0 comments on commit 32d5c7d

Please sign in to comment.