From 9cfd31c471adbe54909499a73618b96b11ef793e Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 4 May 2023 19:53:08 +0100 Subject: [PATCH] Drop flake8/isort, add ruff --- .pre-commit-config.yaml | 13 ++++--------- Makefile | 3 +-- pyproject.toml | 22 ++++++++++++++++++++-- requirements_for_test.txt | 4 +--- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 499705d..b3628d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,16 +6,11 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: debug-statements -- repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.261' hooks: - - id: flake8 - name: flake8 (python) -- repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - name: isort (python) + - id: ruff + args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black rev: 22.8.0 hooks: diff --git a/Makefile b/Makefile index 2a3d95e..0b53940 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,7 @@ build: bootstrap ## Build project (dummy task for CI) .PHONY: test test: ## Run tests - flake8 . - isort --check-only ./notifications_python_client ./utils ./integration_test ./tests + ruff check . black --check . pytest diff --git a/pyproject.toml b/pyproject.toml index 85c3b07..7439176 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,23 @@ [tool.black] line-length = 120 -[tool.isort] -profile = "black" +[tool.ruff] +line-length = 120 + +target-version = "py39" + +select = [ + "E", # pycodestyle + "W", # pycodestyle + "F", # pyflakes + "I", # isort + "B", # flake8-bugbear + "C90", # mccabe cyclomatic complexity +] +ignore = [] +exclude = [ + "venv*", + "__pycache__", + "cache", + "build", +] diff --git a/requirements_for_test.txt b/requirements_for_test.txt index 405dd5f..38a7578 100644 --- a/requirements_for_test.txt +++ b/requirements_for_test.txt @@ -1,8 +1,5 @@ . -isort==5.12.0 ; python_version >= '3.8' # Also update `.pre-commit-config.yaml` if this change -isort==5.10.0 ; python_version < '3.8' -flake8>=3.9.2 # Also update `.pre-commit-config.yaml` if this change pytest>=3.0.2 pytest-mock>=1.2 pytest-cov>=2.3.1 @@ -13,3 +10,4 @@ requests-mock>=0.7.0 jsonschema>=2.5.1 black==22.8.0 # Also update `.pre-commit-config.yaml` if this changes +ruff==0.0.261 # Also update `.pre-commit-config.yaml` if this changes