Skip to content

Commit 779da2b

Browse files
authored
replace flake8 with ruff (#1462)
1 parent 0706fcb commit 779da2b

File tree

4 files changed

+13
-26
lines changed

4 files changed

+13
-26
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ repos:
1616
- id: check-yaml
1717
- id: mixed-line-ending
1818
args: ['--fix=lf']
19-
- repo: https://github.com/PyCQA/flake8
20-
rev: 7.1.1
21-
hooks:
22-
- id: flake8
23-
exclude: ^(oauth2_provider/migrations/|tests/migrations/)
2419
- repo: https://github.com/sphinx-contrib/sphinx-lint
2520
rev: v0.9.1
2621
hooks:

docs/contributing.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ add a comment stating you're working on it.
2727
Code Style
2828
==========
2929

30-
The project uses `flake8 <https://flake8.pycqa.org/en/latest/>`_ for linting,
31-
`ruff <https://docs.astral.sh/ruff/>`_ for formatting the code and sorting imports,
32-
and `pre-commit <https://pre-commit.com/>`_ for checking/fixing commits for
33-
correctness before they are made.
30+
The project uses `ruff <https://docs.astral.sh/ruff/>`_ for linting, formatting the code and sorting imports,
31+
and `pre-commit <https://pre-commit.com/>`_ for checking/fixing commits for correctness before they are made.
3432

3533
You will need to install ``pre-commit`` yourself, and then ``pre-commit`` will
36-
take care of installing ``flake8`` and ``ruff``.
34+
take care of installing ``ruff``.
3735

3836
After cloning your repository, go into it and run::
3937

@@ -264,7 +262,7 @@ add a comment. If you think a function is not trivial, add a docstrings.
264262

265263
To see if your code formatting will pass muster use::
266264

267-
tox -e flake8
265+
tox -e lint
268266

269267
The contents of this page are heavily based on the docs from `django-admin2 <https://github.com/twoscoops/django-admin2>`_
270268

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ ignore-words-list = 'assertIn'
77

88
[tool.ruff]
99
line-length = 110
10-
exclude = [".tox", "oauth2_provider/migrations/", "tests/migrations/", "manage.py"]
10+
exclude = [".tox", "build/", "dist/", "docs/", "oauth2_provider/migrations/", "tests/migrations/", "manage.py"]
1111

1212
[tool.ruff.lint]
13-
select = ["I", "Q"]
13+
select = ["E", "F", "I", "Q", "W"]
1414

1515
[tool.ruff.lint.isort]
1616
lines-after-imports = 2

tox.ini

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[tox]
22
envlist =
3-
flake8,
43
migrations,
54
migrate_swapped,
65
docs,
6+
lint,
77
sphinxlint,
88
py{38,39,310,311,312}-dj42,
99
py{310,311,312}-dj50,
@@ -12,7 +12,7 @@ envlist =
1212

1313
[gh-actions]
1414
python =
15-
3.8: py38, docs, flake8, migrations, migrate_swapped, sphinxlint
15+
3.8: py38, docs, lint, migrations, migrate_swapped, sphinxlint
1616
3.9: py39
1717
3.10: py310
1818
3.11: py311
@@ -92,12 +92,13 @@ deps =
9292
jwcrypto
9393
django
9494

95-
[testenv:flake8]
95+
[testenv:lint]
9696
basepython = python3.8
97+
deps = ruff>=0.6
9798
skip_install = True
98-
commands = flake8 {toxinidir}
99-
deps =
100-
flake8
99+
commands =
100+
ruff format --check
101+
ruff check
101102

102103
[testenv:migrations]
103104
setenv =
@@ -129,10 +130,3 @@ omit = */migrations/*
129130

130131
[coverage:report]
131132
show_missing = True
132-
133-
[flake8]
134-
max-line-length = 110
135-
exclude = docs/, oauth2_provider/migrations/, tests/migrations/, .tox/, build/, dist/
136-
application-import-names = oauth2_provider
137-
inline-quotes = double
138-
extend-ignore = E203, W503

0 commit comments

Comments
 (0)