[CHORE] switch to pyproject and ruff
This commit is contained in:
parent
f0a60f97b5
commit
2628dac499
5 changed files with 44 additions and 70 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
# Do NOT update manually; changes here will be overwritten by Copier
|
# Do NOT update manually; changes here will be overwritten by Copier
|
||||||
_commit: v1.37
|
_commit: v1.37
|
||||||
_src_path: https://github.com/OCA/oca-addons-repo-template
|
_src_path: https://github.com/OCA/oca-addons-repo-template
|
||||||
|
additional_ruff_rules: []
|
||||||
ci: GitHub
|
ci: GitHub
|
||||||
convert_readme_fragments_to_markdown: false
|
convert_readme_fragments_to_markdown: false
|
||||||
enable_checklog_odoo: true
|
enable_checklog_odoo: true
|
||||||
|
|
@ -22,6 +23,6 @@ repo_description: Open Source Odoo Apps i develop and maintain for projects of m
|
||||||
repo_name: madmooose OSS Odoo Apps
|
repo_name: madmooose OSS Odoo Apps
|
||||||
repo_slug: odooapps
|
repo_slug: odooapps
|
||||||
repo_website: https://ziemlichoptimal.de
|
repo_website: https://ziemlichoptimal.de
|
||||||
use_pyproject_toml: false
|
use_pyproject_toml: true
|
||||||
use_ruff: false
|
use_ruff: true
|
||||||
|
|
||||||
|
|
|
||||||
12
.flake8
12
.flake8
|
|
@ -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
|
|
||||||
13
.isort.cfg
13
.isort.cfg
|
|
@ -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
|
|
||||||
|
|
@ -38,6 +38,10 @@ repos:
|
||||||
entry: found a en.po file
|
entry: found a en.po file
|
||||||
language: fail
|
language: fail
|
||||||
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
|
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
|
||||||
|
- repo: https://github.com/sbidoul/whool
|
||||||
|
rev: v1.3
|
||||||
|
hooks:
|
||||||
|
- id: whool-init
|
||||||
- repo: https://github.com/oca/maintainer-tools
|
- repo: https://github.com/oca/maintainer-tools
|
||||||
rev: f9b919b9868143135a9c9cb03021089cabba8223
|
rev: f9b919b9868143135a9c9cb03021089cabba8223
|
||||||
hooks:
|
hooks:
|
||||||
|
|
@ -53,6 +57,7 @@ repos:
|
||||||
- --repo-name=odooapps
|
- --repo-name=odooapps
|
||||||
- --if-source-changed
|
- --if-source-changed
|
||||||
- --keep-source-digest
|
- --keep-source-digest
|
||||||
|
- id: oca-gen-external-dependencies
|
||||||
- repo: https://github.com/OCA/odoo-pre-commit-hooks
|
- repo: https://github.com/OCA/odoo-pre-commit-hooks
|
||||||
rev: v0.0.25
|
rev: v0.0.25
|
||||||
hooks:
|
hooks:
|
||||||
|
|
@ -60,21 +65,6 @@ repos:
|
||||||
- id: oca-checks-po
|
- id: oca-checks-po
|
||||||
args:
|
args:
|
||||||
- --disable=po-pretty-format
|
- --disable=po-pretty-format
|
||||||
- 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: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
|
|
@ -127,35 +117,12 @@ repos:
|
||||||
- id: check-xml
|
- id: check-xml
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
args: ["--fix=lf"]
|
args: ["--fix=lf"]
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v2.38.2
|
rev: v0.1.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: ruff
|
||||||
args: ["--keep-percent-format"]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
- repo: https://github.com/PyCQA/isort
|
- id: ruff-format
|
||||||
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:
|
|
||||||
- id: setuptools-odoo-make-default
|
|
||||||
- id: setuptools-odoo-get-requirements
|
|
||||||
args:
|
|
||||||
- --output
|
|
||||||
- requirements.txt
|
|
||||||
- --header
|
|
||||||
- "# generated from manifests external_dependencies"
|
|
||||||
- repo: https://github.com/PyCQA/flake8
|
|
||||||
rev: 5.0.0
|
|
||||||
hooks:
|
|
||||||
- id: flake8
|
|
||||||
name: flake8
|
|
||||||
additional_dependencies: ["flake8-bugbear==21.9.2"]
|
|
||||||
- repo: https://github.com/OCA/pylint-odoo
|
- repo: https://github.com/OCA/pylint-odoo
|
||||||
rev: v8.0.19
|
rev: v8.0.19
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
||||||
31
.ruff.toml
Normal file
31
.ruff.toml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
target-version = "py310"
|
||||||
|
fix = true
|
||||||
|
|
||||||
|
[lint]
|
||||||
|
extend-select = [
|
||||||
|
"B",
|
||||||
|
"C90",
|
||||||
|
"E501", # line too long (default 88)
|
||||||
|
"I", # isort
|
||||||
|
"UP", # pyupgrade
|
||||||
|
]
|
||||||
|
extend-safe-fixes = ["UP008"]
|
||||||
|
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
|
||||||
Loading…
Reference in a new issue