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/
This commit is contained in:
Hugo Osvaldo Barrera 2023-01-30 17:39:36 +01:00 committed by Hugo
parent 8c6c0be15a
commit d646357cd3
4 changed files with 20 additions and 32 deletions

View file

@ -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

View file

@ -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

15
pyproject.toml Normal file
View file

@ -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

View file

@ -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: