From 299cb36409bc774359508f6dc46ccf18ce7290dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 28 Oct 2023 14:16:57 +0200 Subject: [PATCH] Simplify linters using ruff --- .flake8 | 1 - .isort.cfg | 1 - .pre-commit-config.yaml | 23 ++++++----------------- pyproject.toml | 11 +++++++++++ 4 files changed, 17 insertions(+), 19 deletions(-) delete mode 120000 .flake8 delete mode 120000 .isort.cfg diff --git a/.flake8 b/.flake8 deleted file mode 120000 index 1d5a410..0000000 --- a/.flake8 +++ /dev/null @@ -1 +0,0 @@ -./src/{% if odoo_version >= 13 %}.flake8{% endif %} \ No newline at end of file diff --git a/.isort.cfg b/.isort.cfg deleted file mode 120000 index debd98c..0000000 --- a/.isort.cfg +++ /dev/null @@ -1 +0,0 @@ -./src/{% if odoo_version > 12 %}.isort.cfg{% endif %} \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f73681f..95fb195 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,4 @@ repos: - - 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: @@ -10,7 +6,7 @@ repos: # https://github.com/prettier/prettier/issues/12143 exclude: "}$" - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.5.0 hooks: - id: check-case-conflict - id: check-docstring-first @@ -25,16 +21,9 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - id: trailing-whitespace - - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 - hooks: - - id: flake8 - additional_dependencies: ["flake8-bugbear==21.9.2"] - - repo: https://github.com/asottile/pyupgrade - rev: v2.29.0 - hooks: - - id: pyupgrade - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.3 hooks: - - id: isort + - id: ruff + args: [--exit-non-zero-on-fix] + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 2eba5a3..b7515ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,3 +17,14 @@ pytest-xdist = "*" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +# ruff + +[tool.ruff] +fix = true + +[tool.ruff.lint] +extend-select = [ + "UP", # pyupgrade + "I", # isort +]