Skip to content

Commit e93eba1

Browse files
authored
Replace flake8/isort/black with ruff (#541)
1 parent ff212e9 commit e93eba1

4 files changed

Lines changed: 36 additions & 34 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ db.sqlite3
9999
# local data
100100
local/
101101

102+
# ruff
103+
.ruff_cache
104+
102105
# runtime data
103106
runtime/
104107

.pre-commit-config.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@ repos:
1515
hooks:
1616
- id: pyupgrade
1717
args: [--py38-plus]
18-
- repo: https://github.com/PyCQA/isort
19-
rev: 6.0.1
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
# Ruff version.
20+
rev: v0.12.4
2021
hooks:
21-
- id: isort
22-
- repo: https://github.com/psf/black-pre-commit-mirror
23-
rev: 25.1.0
24-
hooks:
25-
- id: black
26-
language_version: python3
27-
- repo: https://github.com/PyCQA/flake8
28-
rev: 7.3.0
29-
hooks:
30-
- id: flake8
22+
# Run the linter.
23+
- id: ruff-check
24+
args: [ --fix ]
25+
# Run the formatter.
26+
- id: ruff-format
3127
- repo: https://github.com/codespell-project/codespell
3228
rev: v2.4.1
3329
hooks:

pyproject.toml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,35 @@ skip = ".git,*.pdf,*.svg"
7070
ignore-regex = "\bNd\b"
7171
ignore-words-list = "re-use"
7272

73-
[tool.isort]
74-
profile = "black"
75-
split_on_trailing_comma = true
76-
combine_as_imports = true
77-
7873
[tool.setuptools_scm]
7974
# To enable SCM versioning, we need an empty tool configuration for setuptools_scm
8075

8176
[tool.check-wheel-contents]
8277
# WOO7: wheel library is empty
8378
# W008: wheel is empty
8479
ignore = "W007,W008"
80+
81+
[tool.ruff.lint]
82+
# In addition to the default rules, these additional rules will be used:
83+
extend-select = [
84+
"E", # pycodestyle
85+
"W", # pycodestyle
86+
"F", # pyflakes
87+
"UP", # pyupgrade
88+
"B", # flake8-bugbear
89+
"YTT", # flake8-2020
90+
"ASYNC", # flake8-async
91+
"C4", # flake8-comprehensions
92+
"I", # isort
93+
# The SIM rules are *very* opinionated, and don't necessarily make for better code.
94+
# They may be worth occasionally turning on just to see if something could actually
95+
# use improvement.
96+
# "SIM", # flake8-simplify
97+
]
98+
ignore = [
99+
"F821", # Undefined name `tags`
100+
"E501" # Line too long
101+
]
102+
103+
[tool.ruff.lint.isort]
104+
combine-as-imports = true

tox.ini

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
# Flake8 doesn't believe in pyproject.toml, so we put the configuration here.
2-
[flake8]
3-
# https://flake8.readthedocs.org/en/latest/
4-
exclude=\
5-
venv*/*,\
6-
local/*,\
7-
docs/*,\
8-
build/*,\
9-
tests/apps/*,\
10-
.eggs/*,\
11-
.tox/*
12-
max-line-length = 119
13-
extend-ignore =
14-
# whitespace before :
15-
# See https://github.com/PyCQA/pycodestyle/issues/373
16-
E203,
17-
181
[tox]
192
envlist = pre-commit,package,docs-lint,docs-all
203

0 commit comments

Comments
 (0)