From d646357cd38ccf4a24639b7b6864062f483f033e Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 30 Jan 2023 17:39:36 +0100 Subject: [PATCH] Use ruff for code checking and linting `isort` is failing in pre-commit.ci right now, so this might be good timing. See: https://whynothugo.nl/journal/2023/01/20/notes-on-ruff/ --- .pre-commit-config.yaml | 20 ++++---------------- docs/contributing.rst | 2 +- pyproject.toml | 15 +++++++++++++++ setup.cfg | 15 --------------- 4 files changed, 20 insertions(+), 32 deletions(-) create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 17ff093..71cf177 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,26 +8,10 @@ repos: - id: check-toml - id: check-added-large-files - id: debug-statements - - repo: https://github.com/PyCQA/flake8 - rev: "6.0.0" - hooks: - - id: flake8 - additional_dependencies: - - flake8-bugbear - repo: https://github.com/psf/black rev: "22.10.0" hooks: - id: black - - repo: https://github.com/pycqa/isort - rev: 5.10.1 - hooks: - - id: isort - name: isort (python) - - repo: https://github.com/asottile/pyupgrade - rev: v3.3.0 - hooks: - - id: pyupgrade - args: [--py37-plus] - repo: https://github.com/pre-commit/mirrors-mypy rev: "v0.991" hooks: @@ -38,3 +22,7 @@ repos: - types-docutils - types-requests - types-atomicwrites + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.237' + hooks: + - id: ruff diff --git a/docs/contributing.rst b/docs/contributing.rst index c4f661d..08a7aa1 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -81,7 +81,7 @@ virtualenv_ and run this inside of it:: # Install development dependencies, including: # - vdirsyncer from the repo into the virtualenv - # - stylecheckers (flake8) and code formatters (autopep8) + # - stylecheckers (ruff) and code formatters (black) make install-dev # Install git commit hook for some extra linting and checking diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f224bb5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.ruff] +select = [ + "E", + "F", + "W", + "B0", + "I", + "UP", + "C4", + # "TID", +] +target-version = "py37" + +[tool.ruff.isort] +force-single-line = true diff --git a/setup.cfg b/setup.cfg index 4e8257e..642d06f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,21 +8,6 @@ addopts = --color=yes # filterwarnings=error -[flake8] -application-import-names = tests,vdirsyncer -extend-ignore = - # Black-incompatible colon spacing. - E203, - # Line jump before binary operator. - W503, - I100, - I202 -max-line-length = 88 -exclude = .eggs,build - -[isort] -force_single_line=true - [mypy] ignore_missing_imports = True # See https://github.com/python/mypy/issues/7511: