From 397aa93f8e5997b85bf69ecefcf325c4f88a2202 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Sat, 27 Apr 2024 15:05:17 +0100 Subject: [PATCH 1/2] [REF] dotfiles: copier update to 1.20 --- .copier-answers.yml | 6 +++++- .flake8 | 12 ------------ .gitignore | 1 + .isort.cfg | 13 ------------- .pre-commit-config.yaml | 43 +++++++++-------------------------------- .ruff.toml | 30 ++++++++++++++++++++++++++++ 6 files changed, 45 insertions(+), 60 deletions(-) delete mode 100644 .flake8 delete mode 100644 .isort.cfg create mode 100644 .ruff.toml diff --git a/.copier-answers.yml b/.copier-answers.yml index 8e13db0f7..d24ede6c5 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,7 +1,9 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.17.2 +_commit: v1.20 _src_path: gh:oca/oca-addons-repo-template +additional_ruff_rules: [] ci: GitHub +convert_readme_fragments_to_markdown: false generate_requirements_txt: true github_check_license: true github_ci_extra_env: {} @@ -19,4 +21,6 @@ repo_description: 'TODO: add repo description.' repo_name: connector-magento repo_slug: connector-magento repo_website: https://github.com/OCA/connector-magento +use_pyproject_toml: false +use_ruff: true diff --git a/.flake8 b/.flake8 deleted file mode 100644 index e397e8ed4..000000000 --- a/.flake8 +++ /dev/null @@ -1,12 +0,0 @@ -[flake8] -max-line-length = 88 -max-complexity = 16 -# B = bugbear -# B9 = bugbear opinionated (incl line length) -select = C,E,F,W,B,B9 -# E203: whitespace before ':' (black behaviour) -# E501: flake8 line length (covered by bugbear B950) -# W503: line break before binary operator (black behaviour) -ignore = E203,E501,W503 -per-file-ignores= - __init__.py:F401 diff --git a/.gitignore b/.gitignore index 9c283fd41..0090721f5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] /.venv /.pytest_cache +/.ruff_cache # C extensions *.so diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 0ec187efd..000000000 --- a/.isort.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad0a950d0..eb82e29e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,8 @@ exclude: | ^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: @@ -35,7 +37,7 @@ repos: language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: 969238e47c07d0c40573acff81d170f63245d738 + rev: 9a170331575a265c092ee6b24b845ec508e8ef75 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons @@ -48,26 +50,12 @@ repos: - --org-name=OCA - --repo-name=connector-magento - --if-source-changed + - --keep-source-digest - repo: https://github.com/OCA/odoo-pre-commit-hooks rev: v0.0.25 hooks: - id: oca-checks-odoo-module - id: oca-checks-po - - repo: https://github.com/myint/autoflake - rev: v1.6.1 - 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.8.0 - hooks: - - id: black - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.7.1 hooks: @@ -109,19 +97,6 @@ repos: - id: check-xml - id: mixed-line-ending args: ["--fix=lf"] - - repo: https://github.com/asottile/pyupgrade - rev: v2.38.2 - 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: @@ -132,12 +107,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: v8.0.19 hooks: diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 000000000..0240c75f6 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,30 @@ + +target-version = "py310" +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 From 11a11925fbe223255a4d7119737bbc548ec4189c Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Sat, 27 Apr 2024 15:06:18 +0100 Subject: [PATCH 2/2] [REF] dotfiles: copier update to 1.20 --- .copier-answers.yml | 2 +- .pre-commit-config.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index d24ede6c5..e2f264325 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -3,7 +3,7 @@ _commit: v1.20 _src_path: gh:oca/oca-addons-repo-template additional_ruff_rules: [] ci: GitHub -convert_readme_fragments_to_markdown: false +convert_readme_fragments_to_markdown: true generate_requirements_txt: true github_check_license: true github_ci_extra_env: {} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb82e29e3..cb01dc5e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,6 +51,7 @@ repos: - --repo-name=connector-magento - --if-source-changed - --keep-source-digest + - --convert-fragments-to-markdown - repo: https://github.com/OCA/odoo-pre-commit-hooks rev: v0.0.25 hooks: