Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPD conf from OCA #100

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/{% if odoo_version < 13 %}.flake8{% endif %}.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- include "version-specific/mqt-compat/.flake8" %}
1 change: 1 addition & 0 deletions src/{% if odoo_version > 12 %}.eslintrc.yml{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ globals:
odoo: readonly
openerp: readonly
owl: readonly
luxon: readonly

# Styling is handled by Prettier, so we only need to enable AST rules;
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[settings]
; see https://github.com/psf/black
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
combine_as_imports=True
use_parentheses=True
line_length=88
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
default_section=THIRDPARTY
ensure_newline_before_comments = True
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
{%- set repo_rev.flake8 = "3.8.3" %}
{%- set repo_rev.flake8_bugbear = "20.1.4" %}
{%- set repo_rev.isort = "5.12.0" %}
{%- set repo_rev.maintainer_tools = "ab1d7f6" %}
{%- set repo_rev.maintainer_tools = "f71041f22b8cd68cf7c77b73a14ca8d8cd190a60" %}
{%- set repo_rev.nodejs = "14.13.0" %}
{%- set repo_rev.odoo_pre_commit_hooks = "v0.0.25" %}
{%- set repo_rev.pre_commit_hooks = "v3.2.0" %}
{%- set repo_rev.prettier = "2.1.2" %}
{%- set repo_rev.prettier_xml = "0.12.0" %}
Expand All @@ -25,13 +26,14 @@
{%- set repo_rev.flake8 = "3.9.2" %}
{%- set repo_rev.flake8_bugbear = "21.9.2" %}
{%- set repo_rev.isort = "5.12.0" %}
{%- set repo_rev.maintainer_tools = "dfba427ba03900b69e0a7f2c65890dc48921d36a" %}
{%- set repo_rev.maintainer_tools = "f71041f22b8cd68cf7c77b73a14ca8d8cd190a60" %}
{%- set repo_rev.nodejs = "14.18.0" %}
{%- set repo_rev.odoo_pre_commit_hooks = "v0.0.25" %}
{%- set repo_rev.pre_commit_hooks = "v4.0.1" %}
{%- set repo_rev.prettier = "2.4.1" %}
{%- set repo_rev.prettier_xml = "1.1.0" %}
{%- set repo_rev.pylint = "v2.11.1" %}
{%- set repo_rev.pylint_odoo = "7.0.2" %}
{%- set repo_rev.pylint_odoo = "7.0.5" %}
{%- set repo_rev.pyupgrade = "v2.29.0" %}
{%- set repo_rev.setuptools_odoo = "3.1.8" %}
{%- else %}
Expand All @@ -41,12 +43,13 @@
{%- set repo_rev.flake8 = "3.9.2" %}
{%- set repo_rev.flake8_bugbear = "21.9.2" %}
{%- set repo_rev.isort = "5.12.0" %}
{%- set repo_rev.maintainer_tools = "4cd2b852214dead80822e93e6749b16f2785b2fe" %}
{%- set repo_rev.maintainer_tools = "f71041f22b8cd68cf7c77b73a14ca8d8cd190a60" %}
{%- set repo_rev.nodejs = "16.17.0" %}
{%- set repo_rev.odoo_pre_commit_hooks = "v0.0.25" %}
{%- set repo_rev.pre_commit_hooks = "v4.3.0" %}
{%- set repo_rev.prettier = "2.7.1" %}
{%- set repo_rev.prettier_xml = "2.2.0" %}
{%- set repo_rev.pylint_odoo = "7.0.2" %}
{%- set repo_rev.pylint_odoo = "v8.0.19" %}
{%- set repo_rev.pyupgrade = "v2.38.2" %}
{%- set repo_rev.setuptools_odoo = "3.1.8" %}
{%- endif %}
Expand All @@ -66,6 +69,10 @@ exclude: |
/static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# Don't bother non-technical authors with formatting issues in docs
readme/.*\.(rst|md)$|
# Ignore build and dist directories in addons
/build/|/dist/|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
Expand All @@ -86,13 +93,39 @@ repos:
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
{%- if use_pyproject_toml %}
- repo: https://github.com/sbidoul/whool
rev: v0.5
hooks:
- id: whool-init
{%- endif %}
- repo: https://github.com/oca/maintainer-tools
rev: {{ repo_rev.maintainer_tools }}
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
args: ["{{ repo_website }}"]
- id: oca-gen-addon-readme
args:
- --addons-dir=.
- --branch={{ "%.01f" | format(odoo_version) }}
- --org-name={{ org_slug }}
- --repo-name={{ repo_slug }}
- --if-source-changed
- --keep-source-digest
{%- if convert_readme_fragments_to_markdown %}
- --convert-fragments-to-markdown
{%- endif %}
{%- if use_pyproject_toml and generate_requirements_txt %}
- id: oca-gen-external-dependencies
{%- endif %}
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: {{ repo_rev.odoo_pre_commit_hooks }}
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
{%- if not use_ruff %}
- repo: https://github.com/myint/autoflake
rev: {{ repo_rev.autoflake }}
hooks:
Expand All @@ -108,6 +141,7 @@ repos:
rev: {{ repo_rev.black }}
hooks:
- id: black
{%- endif %}
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v{{ repo_rev.prettier }}
hooks:
Expand Down Expand Up @@ -149,11 +183,15 @@ repos:
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
{#- ruff doesn't support python 3.6 #}
{%- if not use_ruff or odoo_version < 15.0 %}
- repo: https://github.com/asottile/pyupgrade
rev: {{ repo_rev.pyupgrade }}
hooks:
- id: pyupgrade
args: ["--keep-percent-format"]
{%- endif %}
{%- if not use_ruff %}
- repo: https://github.com/PyCQA/isort
rev: {{ repo_rev.isort }}
hooks:
Expand All @@ -162,13 +200,25 @@ repos:
args:
- --settings=.
exclude: /__init__\.py$
{%- endif %}
{%- if not use_pyproject_toml %}

{%- endif %}
{%- if not use_ruff %}
- repo: https://github.com/PyCQA/flake8
rev: {{ repo_rev.flake8 }}
hooks:
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear=={{ repo_rev.flake8_bugbear }}"]
{%- else %}
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
{%- endif %}
- repo: https://github.com/OCA/pylint-odoo
rev: {{ repo_rev.pylint_odoo }}
hooks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@ load-plugins=pylint_odoo
score=n

[ODOOLINT]
{%- if odoo_version < 16 %}
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest_required_authors={{ org_name }}
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid_odoo_versions={{ odoo_version }}
{%- else %}
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors={{ org_name }}
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid-odoo-versions={{ odoo_version }}
{%- endif %}

[MESSAGES CONTROL]
disable=all
Expand Down
4 changes: 2 additions & 2 deletions update_oca_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
".pylintrc-mandatory.jinja",
".pylintrc.jinja",
"{% if odoo_version > 12 %}.eslintrc.yml{% endif %}",
"{% if odoo_version > 12 %}.isort.cfg{% endif %}",
"{% if odoo_version > 12 and not use_ruff %}.isort.cfg{% endif %}",
"{% if odoo_version > 12 %}.prettierrc.yml{% endif %}",
"{% if odoo_version >= 13 %}.flake8{% endif %}",
"{% if odoo_version < 13 %}.flake8{% endif %}.jinja",
]

base_url = "https://raw.githubusercontent.com/OCA/oca-addons-repo-template/master/src/"
Expand Down