Skip to content

Commit 33819c6

Browse files
yacPetrDlouhy
authored andcommitted
Use ruff for linting
ruff does the job of flake8, pep8, pycodestyle, isort, and more while supporting pyproject.toml configuration - better, faster, stronger. Migrate flake8 config from setup.cfg to ruff config in pyproject.toml. Also bump versions in .pre-commit-config.yml to latest.
1 parent 0d942f6 commit 33819c6

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Pre-commit configuration matching GitHub CI exactly
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.6.0
4+
rev: v6.0.0
55
hooks:
66
- id: trailing-whitespace
77
exclude: ^(test_env/|\.tox/|venv/|env/)
@@ -11,22 +11,13 @@ repos:
1111
- id: check-added-large-files
1212
- id: check-merge-conflict
1313

14-
- repo: https://github.com/pycqa/flake8
15-
rev: 7.1.1
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.14.8
1616
hooks:
17-
- id: flake8
18-
exclude: ^(test_env/|\.tox/|venv/|env/)
19-
20-
- repo: https://github.com/pycqa/isort
21-
rev: 5.13.2
22-
hooks:
23-
- id: isort
24-
args: [--profile=black]
25-
# Make isort compatible with black formatting
26-
exclude: ^(test_env/|\.tox/|venv/|env/)
17+
- id: ruff-check
2718

2819
- repo: https://github.com/psf/black
29-
rev: 24.10.0
20+
rev: 25.12.0
3021
hooks:
3122
- id: black
3223
# GitHub CI runs: black --check . (no custom line-length, uses default)

demo/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ maxminddb-geolite2
1010
model_bakery
1111
django-concurrent-test-helper
1212
freezegun
13-
flake8
1413
psycopg2-binary
1514
internet-sabotage3>=0.1.6
1615
django_coverage_plugin

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,24 @@ include = ["plans", "plans.*", "plans_i18n"]
6262
[tool.pytest.ini_options]
6363
python_files = "test*.py"
6464
addopts = "--tb=short"
65+
66+
[tool.ruff]
67+
line-length = 120
68+
exclude = [
69+
"env",
70+
"venv",
71+
".venv",
72+
".tox",
73+
"bow",
74+
"docs",
75+
"migrations",
76+
"node_modules",
77+
"static",
78+
]
79+
80+
[tool.ruff.lint]
81+
select = ["E", "W", "F", "N", "I"]
82+
ignore = [
83+
"N802", # function name should be lowercase
84+
"N806", # variable in function should be lowercase
85+
]

setup.cfg

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

0 commit comments

Comments
 (0)