mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
dotfiles: update pre-commit config
This commit is contained in:
@@ -27,7 +27,7 @@ jobs:
|
|||||||
run: pre-commit run --all-files --show-diff-on-failure --color=always
|
run: pre-commit run --all-files --show-diff-on-failure --color=always
|
||||||
- name: Check that all files generated by pre-commit are in git
|
- name: Check that all files generated by pre-commit are in git
|
||||||
run: |
|
run: |
|
||||||
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
|
newfiles="$(git ls-files --others --exclude-from=.gitignore --exclude=.ruff_cache)"
|
||||||
if [ "$newfiles" != "" ] ; then
|
if [ "$newfiles" != "" ] ; then
|
||||||
echo "Please check-in the following files:"
|
echo "Please check-in the following files:"
|
||||||
echo "$newfiles"
|
echo "$newfiles"
|
||||||
|
|||||||
+56
-105
@@ -21,119 +21,70 @@ exclude: |
|
|||||||
^docs/_templates/.*\.html$|
|
^docs/_templates/.*\.html$|
|
||||||
# You don't usually want a bot to modify your legal texts
|
# You don't usually want a bot to modify your legal texts
|
||||||
(LICENSE.*|COPYING.*)
|
(LICENSE.*|COPYING.*)
|
||||||
default_language_version:
|
|
||||||
python: python3
|
|
||||||
node: "16.17.0"
|
|
||||||
repos:
|
repos:
|
||||||
- repo: local
|
|
||||||
|
# pylint
|
||||||
|
- repo: https://github.com/pycqa/pylint
|
||||||
|
rev: v4.0.5
|
||||||
hooks:
|
hooks:
|
||||||
# These files are most likely copier diff rejection junks; if found,
|
- id: pylint
|
||||||
# review them manually, fix the problem (if needed) and remove them
|
name: pylint odoo
|
||||||
- id: forbidden-files
|
# check only specific Odoo addons
|
||||||
name: forbidden files
|
files: odoo/local-src/
|
||||||
entry: found forbidden files; remove them
|
types: ['file', 'python'] # to not check .csv and .conf files
|
||||||
language: fail
|
args: ["--rcfile=.ci/pylintrc_odoo"]
|
||||||
files: "\\.rej$"
|
additional_dependencies: [pylint-odoo==v10.0.1]
|
||||||
- id: en-po-files
|
|
||||||
name: en.po files cannot exist
|
# pre-commit-hooks
|
||||||
entry: found a en.po file
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
language: fail
|
rev: v6.0.0
|
||||||
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
|
|
||||||
- repo: https://github.com/oca/maintainer-tools
|
|
||||||
rev: 4cd2b852214dead80822e93e6749b16f2785b2fe
|
|
||||||
hooks:
|
hooks:
|
||||||
# update the NOT INSTALLABLE ADDONS section above
|
- id: check-yaml
|
||||||
- id: oca-update-pre-commit-excluded-addons
|
|
||||||
- id: oca-fix-manifest-website
|
|
||||||
args: ["https://github.com/camptocamp/odoo-cloud-platform"]
|
|
||||||
- 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:
|
|
||||||
- id: prettier
|
|
||||||
name: prettier (with plugin-xml)
|
|
||||||
additional_dependencies:
|
|
||||||
- "prettier@2.7.1"
|
|
||||||
- "@prettier/plugin-xml@2.2.0"
|
|
||||||
args:
|
|
||||||
- --plugin=@prettier/plugin-xml
|
|
||||||
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
|
||||||
rev: v8.24.0
|
|
||||||
hooks:
|
|
||||||
- id: eslint
|
|
||||||
verbose: true
|
|
||||||
args:
|
|
||||||
- --color
|
|
||||||
- --fix
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
||||||
rev: v4.3.0
|
|
||||||
hooks:
|
|
||||||
- id: trailing-whitespace
|
|
||||||
# exclude autogenerated files
|
|
||||||
exclude: /README\.rst$|\.pot?$
|
|
||||||
- id: end-of-file-fixer
|
|
||||||
# exclude autogenerated files
|
|
||||||
exclude: /README\.rst$|\.pot?$
|
|
||||||
- id: debug-statements
|
|
||||||
- id: fix-encoding-pragma
|
|
||||||
args: ["--remove"]
|
|
||||||
- id: check-case-conflict
|
|
||||||
- id: check-docstring-first
|
|
||||||
- id: check-executables-have-shebangs
|
|
||||||
- id: check-merge-conflict
|
|
||||||
# exclude files where underlines are not distinguishable from merge conflicts
|
|
||||||
exclude: /README\.rst$|^docs/.*\.rst$
|
|
||||||
- id: check-symlinks
|
- id: check-symlinks
|
||||||
- id: check-xml
|
- id: check-xml
|
||||||
|
- id: debug-statements
|
||||||
|
- id: end-of-file-fixer
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
args: ["--fix=lf"]
|
args: ["--fix=lf"]
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
types_or: [python, javascript, css, xml, yaml]
|
||||||
rev: v2.38.2
|
- id: trailing-whitespace
|
||||||
|
types_or: [python, javascript, css, xml, yaml]
|
||||||
|
|
||||||
|
# Odoo pre-commit hooks
|
||||||
|
- repo: https://github.com/OCA/odoo-pre-commit-hooks
|
||||||
|
rev: v0.2.20
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: oca-checks-odoo-module
|
||||||
args: ["--keep-percent-format"]
|
|
||||||
- repo: https://github.com/PyCQA/isort
|
|
||||||
rev: 5.12.0
|
|
||||||
hooks:
|
|
||||||
- id: isort
|
|
||||||
name: isort except __init__.py
|
|
||||||
args:
|
args:
|
||||||
- --settings=.
|
- --disable=
|
||||||
exclude: /__init__\.py$
|
xml-deprecated-tree-attribute,
|
||||||
- repo: https://github.com/acsone/setuptools-odoo
|
xml-header-wrong,
|
||||||
rev: 3.1.8
|
xml-id-position-first,
|
||||||
|
- id: oca-checks-po
|
||||||
|
args: ["--fix"]
|
||||||
|
|
||||||
|
# ruff (= flake8 + isort + pyupgrade)
|
||||||
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
|
rev: v0.15.4
|
||||||
|
hooks:
|
||||||
|
- id: ruff-check
|
||||||
|
args: [--fix, --show-fixes]
|
||||||
|
exclude: __manifest__.py|__init__.py
|
||||||
|
- id: ruff-format
|
||||||
|
args: [--diff]
|
||||||
|
exclude: __manifest__.py|__init__.py
|
||||||
|
- id: ruff-format
|
||||||
|
exclude: __manifest__.py|__init__.py
|
||||||
|
|
||||||
|
# rstcheck
|
||||||
|
- repo: https://github.com/rstcheck/rstcheck
|
||||||
|
rev: v6.2.5
|
||||||
|
hooks:
|
||||||
|
- id: rstcheck
|
||||||
|
|
||||||
|
# setuptools-odoo
|
||||||
|
- repo: https://github.com/acsone/setuptools-odoo
|
||||||
|
rev: 3.3.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: setuptools-odoo-make-default
|
- id: setuptools-odoo-make-default
|
||||||
- repo: https://github.com/PyCQA/flake8
|
|
||||||
rev: 5.0.4
|
|
||||||
hooks:
|
|
||||||
- id: flake8
|
|
||||||
name: flake8
|
|
||||||
additional_dependencies: ["flake8-bugbear==21.9.2"]
|
|
||||||
- repo: https://github.com/OCA/pylint-odoo
|
|
||||||
rev: v8.0.19
|
|
||||||
hooks:
|
|
||||||
- id: pylint_odoo
|
|
||||||
name: pylint with optional checks
|
|
||||||
args:
|
|
||||||
- --rcfile=.pylintrc
|
|
||||||
- --exit-zero
|
|
||||||
verbose: true
|
|
||||||
- id: pylint_odoo
|
|
||||||
args:
|
|
||||||
- --rcfile=.pylintrc-mandatory
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
[tool.ruff]
|
||||||
|
line-length = 88
|
||||||
|
target-version = "py312"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
|
select = [
|
||||||
|
"E", # pycodestyle errors
|
||||||
|
"W", # pycodestyle warnings
|
||||||
|
"C90", # mccabe
|
||||||
|
"F", # pyflakes
|
||||||
|
"UP", # pyupgrade
|
||||||
|
"I", # isort
|
||||||
|
]
|
||||||
|
ignore = [
|
||||||
|
"UP031", # pyupgrade: use format specifiers instead of percent format (no autofix)
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.ruff.lint.pycodestyle]
|
||||||
|
# line-length is set in [tool.ruff], and it's used by the formatter
|
||||||
|
# in case the formatted can't autofix the line length, it will be reported as an error
|
||||||
|
# if it exceeds the max-line-length set here. We use 320 which is maximum allowed value.
|
||||||
|
max-line-length = 320
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort]
|
||||||
|
combine-as-imports = true
|
||||||
|
force-wrap-aliases = true
|
||||||
|
known-third-party = [
|
||||||
|
"anthem",
|
||||||
|
"git",
|
||||||
|
"invoke",
|
||||||
|
"marabunta",
|
||||||
|
"openupgradelib",
|
||||||
|
"pkg_resources",
|
||||||
|
"psycopg2",
|
||||||
|
"requests",
|
||||||
|
"setuptools",
|
||||||
|
"urllib2",
|
||||||
|
"yaml",
|
||||||
|
]
|
||||||
|
section-order = [
|
||||||
|
"future",
|
||||||
|
"standard-library",
|
||||||
|
"third-party",
|
||||||
|
"odoo",
|
||||||
|
"first-party",
|
||||||
|
"local-folder",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort.sections]
|
||||||
|
odoo = ["odoo"]
|
||||||
|
|
||||||
|
[tool.ruff.lint.mccabe]
|
||||||
|
max-complexity = 16
|
||||||
Reference in New Issue
Block a user