diff --git a/.copier-answers.yml b/.copier-answers.yml index f11550f39c5e..4f2b9dbbbfcc 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,6 +1,7 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.21.1 +_commit: v1.24 _src_path: gh:oca/oca-addons-repo-template +additional_ruff_rules: [] ci: GitHub convert_readme_fragments_to_markdown: false generate_requirements_txt: true @@ -21,5 +22,5 @@ repo_name: l10n-brazil repo_slug: l10n-brazil repo_website: https://github.com/OCA/l10n-brazil use_pyproject_toml: false -use_ruff: false +use_ruff: true diff --git a/.gitignore b/.gitignore index 0090721f5d24..2b045db39953 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,15 @@ var/ *.egg *.eggs +# Debian packages +*.deb + +# Redhat packages +*.rpm + +# MacOS packages +*.dmg + # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 500bc9476ab3..a451896d4676 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: 9a170331575a265c092ee6b24b845ec508e8ef75 + rev: d5fab7ee87fceee858a3d01048c78a548974d935 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons @@ -60,21 +60,6 @@ repos: hooks: - id: oca-checks-odoo-module - id: oca-checks-po - - repo: https://github.com/myint/autoflake - rev: v1.4 - hooks: - - id: autoflake - args: - - --expand-star-imports - - --ignore-init-module-imports - - --in-place - - --remove-all-unused-imports - - --remove-duplicate-keys - - --remove-unused-variables - - repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.4.1 hooks: @@ -116,19 +101,6 @@ repos: - id: check-xml - id: mixed-line-ending args: ["--fix=lf"] - - repo: https://github.com/asottile/pyupgrade - rev: v2.29.0 - hooks: - - id: pyupgrade - args: ["--keep-percent-format"] - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - name: isort except __init__.py - args: - - --settings=. - exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo rev: 3.1.8 hooks: @@ -139,12 +111,12 @@ repos: - requirements.txt - --header - "# generated from manifests external_dependencies" - - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.3 hooks: - - id: flake8 - name: flake8 - additional_dependencies: ["flake8-bugbear==21.9.2"] + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format - repo: https://github.com/OCA/pylint-odoo rev: 7.0.5 hooks: diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 6e787056112b..7618be6b2ae8 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -1,3 +1,4 @@ + [MASTER] load-plugins=pylint_odoo score=n diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 000000000000..dedfe5ac4ede --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,30 @@ + +target-version = "py38" +fix = true + +[lint] +extend-select = [ + "B", + "C90", + "E501", # line too long (default 88) + "I", # isort + "UP", # pyupgrade +] +exclude = ["setup/*"] + +[format] +exclude = ["setup/*"] + +[per-file-ignores] +"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py +"__manifest__.py" = ["B018"] # useless expression + +[isort] +section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"] + +[isort.sections] +"odoo" = ["odoo"] +"odoo-addons" = ["odoo.addons"] + +[mccabe] +max-complexity = 16