Skip to content

Commit 4040b89

Browse files
committed
Try out ruff.
Use it for everything except isort, because it seems to not have an equivalent of isort's from-first.
1 parent 3601426 commit 4040b89

File tree

4 files changed

+44
-44
lines changed

4 files changed

+44
-44
lines changed

.flake8

Lines changed: 0 additions & 26 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ repos:
1212
- id: mixed-line-ending
1313
args: [--fix, lf]
1414
- id: trailing-whitespace
15+
- repo: https://github.com/charliermarsh/ruff-pre-commit
16+
rev: "v0.0.253"
17+
hooks:
18+
- id: ruff
1519
- repo: https://github.com/PyCQA/isort
1620
rev: 5.12.0
1721
hooks:
1822
- id: isort
19-
- repo: https://github.com/pycqa/flake8
20-
rev: "6.0.0"
21-
hooks:
22-
- id: flake8
23-
- repo: https://github.com/asottile/pyupgrade
24-
rev: v3.3.1
25-
hooks:
26-
- id: pyupgrade
2723
- repo: https://github.com/psf/black
2824
rev: 23.1.0
2925
hooks:

noxfile.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,8 @@ def readme(session):
4848

4949
@session(tags=["style"])
5050
def style(session):
51-
session.install(
52-
"flake8",
53-
"flake8-broken-line",
54-
"flake8-bugbear",
55-
"flake8-commas",
56-
"flake8-docstrings",
57-
"flake8-quotes",
58-
"flake8-tidy-imports",
59-
)
60-
session.run("python", "-m", "flake8", REFERENCING, DOCS, __file__)
51+
session.install("ruff")
52+
session.run("ruff", "check", ROOT)
6153

6254

6355
@session()

pyproject.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,41 @@ exclude = [
6666
"**/tests/__init__.py",
6767
"**/tests/test_*.py",
6868
]
69+
70+
[tool.ruff]
71+
line-length = 79
72+
target-version = "py38"
73+
select = ["B", "D", "E", "F", "Q", "UP", "W"]
74+
ignore = [
75+
# raise SomeException(...) is fine.
76+
"B904",
77+
# It's fine to not have docstrings for magic methods.
78+
"D105",
79+
# This rule makes diffs uglier when expanding docstrings (and it's uglier)
80+
"D200",
81+
# No blank lines before docstrings.
82+
"D203",
83+
# Start docstrings on the second line.
84+
"D212",
85+
# This rule misses sassy docstrings ending with ! or ?.
86+
"D400",
87+
# Section headers should end with a colon not a newline
88+
"D406",
89+
# Underlines aren't needed
90+
"D407",
91+
# Plz spaces after section headers
92+
"D412",
93+
]
94+
extend-exclude = ["suite"]
95+
96+
[tool.ruff.flake8-quotes]
97+
docstring-quotes = "double"
98+
99+
[tool.ruff.per-file-ignores]
100+
"docs/*" = ["D"]
101+
"referencing/tests/*" = ["D"]
102+
"noxfile.py" = ["D"]
103+
104+
[tool.ruff.pyupgrade]
105+
# We support 3.8 + 3.9
106+
keep-runtime-typing = true

0 commit comments

Comments
 (0)