Skip to content

Commit d646357

Browse files
committed
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/
1 parent 8c6c0be commit d646357

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,10 @@ repos:
88
- id: check-toml
99
- id: check-added-large-files
1010
- id: debug-statements
11-
- repo: https://github.com/PyCQA/flake8
12-
rev: "6.0.0"
13-
hooks:
14-
- id: flake8
15-
additional_dependencies:
16-
- flake8-bugbear
1711
- repo: https://github.com/psf/black
1812
rev: "22.10.0"
1913
hooks:
2014
- id: black
21-
- repo: https://github.com/pycqa/isort
22-
rev: 5.10.1
23-
hooks:
24-
- id: isort
25-
name: isort (python)
26-
- repo: https://github.com/asottile/pyupgrade
27-
rev: v3.3.0
28-
hooks:
29-
- id: pyupgrade
30-
args: [--py37-plus]
3115
- repo: https://github.com/pre-commit/mirrors-mypy
3216
rev: "v0.991"
3317
hooks:
@@ -38,3 +22,7 @@ repos:
3822
- types-docutils
3923
- types-requests
4024
- types-atomicwrites
25+
- repo: https://github.com/charliermarsh/ruff-pre-commit
26+
rev: 'v0.0.237'
27+
hooks:
28+
- id: ruff

docs/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ virtualenv_ and run this inside of it::
8181

8282
# Install development dependencies, including:
8383
# - vdirsyncer from the repo into the virtualenv
84-
# - stylecheckers (flake8) and code formatters (autopep8)
84+
# - stylecheckers (ruff) and code formatters (black)
8585
make install-dev
8686

8787
# Install git commit hook for some extra linting and checking

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tool.ruff]
2+
select = [
3+
"E",
4+
"F",
5+
"W",
6+
"B0",
7+
"I",
8+
"UP",
9+
"C4",
10+
# "TID",
11+
]
12+
target-version = "py37"
13+
14+
[tool.ruff.isort]
15+
force-single-line = true

setup.cfg

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ addopts =
88
--color=yes
99
# filterwarnings=error
1010

11-
[flake8]
12-
application-import-names = tests,vdirsyncer
13-
extend-ignore =
14-
# Black-incompatible colon spacing.
15-
E203,
16-
# Line jump before binary operator.
17-
W503,
18-
I100,
19-
I202
20-
max-line-length = 88
21-
exclude = .eggs,build
22-
23-
[isort]
24-
force_single_line=true
25-
2611
[mypy]
2712
ignore_missing_imports = True
2813
# See https://github.com/python/mypy/issues/7511:

0 commit comments

Comments
 (0)