Skip to content

Commit 4e22af6

Browse files
committed
Use ruff for linting
Use ruff instead of flake8+isort+pyupgrade+pygrep-hooks. This change configures ruff to apply all the same rules that these tools apply. I've omitted E501 for now since there are a few violations.
1 parent de7e19c commit 4e22af6

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

.flake8

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

.pre-commit-config.yaml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,18 @@ repos:
77
- id: end-of-file-fixer
88
- id: trailing-whitespace
99
- id: mixed-line-ending
10-
- repo: https://github.com/pycqa/flake8
11-
rev: 6.0.0
12-
hooks:
13-
- id: flake8
1410
- repo: https://github.com/pycqa/doc8
1511
rev: v1.1.1
1612
hooks:
1713
- id: doc8
18-
- repo: https://github.com/asottile/pyupgrade
19-
rev: v3.4.0
20-
hooks:
21-
- id: pyupgrade
22-
args: [--py38-plus]
2314
- repo: https://github.com/adamchainz/django-upgrade
2415
rev: 1.13.0
2516
hooks:
2617
- id: django-upgrade
2718
args: [--target-version, "3.2"]
28-
- repo: https://github.com/pycqa/isort
29-
rev: 5.12.0
30-
hooks:
31-
- id: isort
3219
- repo: https://github.com/pre-commit/pygrep-hooks
3320
rev: v1.10.0
3421
hooks:
35-
- id: python-check-blanket-noqa
36-
- id: python-check-mock-methods
37-
- id: python-no-eval
38-
- id: python-no-log-warn
3922
- id: rst-backticks
4023
- id: rst-directive-colons
4124
- repo: https://github.com/pre-commit/mirrors-prettier
@@ -53,6 +36,11 @@ repos:
5336
types: [file]
5437
args:
5538
- --fix
39+
- repo: https://github.com/charliermarsh/ruff-pre-commit
40+
rev: 'v0.0.267'
41+
hooks:
42+
- id: ruff
43+
args: [--fix, --exit-non-zero-on-fix]
5644
- repo: https://github.com/psf/black
5745
rev: 23.3.0
5846
hooks:

docs/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Style
101101
-----
102102

103103
The Django Debug Toolbar uses `black <https://github.com/psf/black>`__ to
104-
format code and additionally uses flake8 and isort. The toolbar uses
104+
format code and additionally uses ruff. The toolbar uses
105105
`pre-commit <https://pre-commit.com>`__ to automatically apply our style
106106
guidelines when a commit is made. Set up pre-commit before committing with::
107107

pyproject.toml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ packages = ["debug_toolbar"]
5555
[tool.hatch.version]
5656
path = "debug_toolbar/__init__.py"
5757

58-
[tool.isort]
59-
combine_as_imports = true
60-
profile = "black"
58+
[tool.ruff.isort]
59+
combine-as-imports = true
6160

6261
[tool.coverage.html]
6362
skip_covered = true
@@ -75,3 +74,22 @@ source = ["src", ".tox/*/site-packages"]
7574
# Update coverage badge link in README.rst when fail_under changes
7675
fail_under = 94
7776
show_missing = true
77+
78+
[tool.ruff]
79+
select = [
80+
# flake8/Pyflakes
81+
"F",
82+
# flake8/pycodestyle
83+
"E",
84+
"W",
85+
# isort
86+
"I",
87+
# pyupgrade
88+
"UP",
89+
# pygrep-hooks
90+
"PGH",
91+
]
92+
ignore = [
93+
"E501",
94+
]
95+
target-version = "py38"

requirements_dev.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ Jinja2
77
# Testing
88

99
coverage[toml]
10-
flake8
1110
html5lib
12-
isort
1311
selenium
1412
tox
1513
black

0 commit comments

Comments
 (0)