Skip to content

Commit c5f5cfe

Browse files
chore: migrate to ruff instead of pycodestyle and isort
1 parent bc65990 commit c5f5cfe

6 files changed

Lines changed: 25 additions & 16 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
5858
quality: ## check coding style with pycodestyle and pylint
5959
tox -e quality
6060

61-
format: ## format code with black and isort
61+
format: ## format code with black and isort. Enable ruff to fix E (pycodestyle) and I (isort) issues
6262
ruff format openedx_authz tests --line-length 120
63-
ruff check --select I --fix --line-length 120
63+
ruff check --select E,I --fix --line-length 120
6464

6565
pii_check: ## check for PII annotations on all Django models
6666
tox -e pii_check

requirements/dev.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ pycasbin==2.2.0
224224
# -r requirements/quality.txt
225225
# casbin-django-orm-adapter
226226
# redis-watcher
227-
pycodestyle==2.14.0
228-
# via -r requirements/quality.txt
229227
pycparser==2.23
230228
# via
231229
# -r requirements/quality.txt

requirements/quality.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,5 @@
55
-r test.txt # Core and testing dependencies for this package
66

77
edx-lint # edX pylint rules and plugins
8-
isort # to standardize order of imports
9-
pycodestyle # PEP 8 compliance validation
108
pydocstyle # PEP 257 compliance validation
119
ruff # Fast Python linter and formatter

requirements/quality.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ iniconfig==2.1.0
122122
# -r requirements/test.txt
123123
# pytest
124124
isort==6.0.1
125-
# via
126-
# -r requirements/quality.in
127-
# pylint
125+
# via pylint
128126
jinja2==3.1.6
129127
# via
130128
# -r requirements/test.txt
@@ -158,8 +156,6 @@ pycasbin==2.2.0
158156
# -r requirements/test.txt
159157
# casbin-django-orm-adapter
160158
# redis-watcher
161-
pycodestyle==2.14.0
162-
# via -r requirements/quality.in
163159
pycparser==2.23
164160
# via
165161
# -r requirements/test.txt

ruff.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Ruff configuration for openedx-authz
2+
# See https://docs.astral.sh/ruff/configuration/
3+
4+
line-length = 120
5+
6+
[lint]
7+
# E: pycodestyle errors
8+
# I: isort import sorting
9+
select = ["E", "I"]
10+
11+
exclude = [
12+
".git",
13+
".tox",
14+
"migrations",
15+
"__pycache__",
16+
"*.pyc",
17+
]

tox.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ envlist = py{311,312}-django{42,52}
55
; D001 = Line too long
66
ignore = D001
77

8-
[pycodestyle]
9-
exclude = .git,.tox,migrations
10-
max-line-length = 120
8+
[ruff]
9+
# Configuration moved to ruff.toml
10+
# select = E (pycodestyle errors), I (isort)
11+
# max-line-length = 120
1112

1213
[pydocstyle]
1314
; D101 = Missing docstring in public class
@@ -75,9 +76,8 @@ commands =
7576
touch tests/__init__.py
7677
pylint openedx_authz tests test_utils manage.py setup.py
7778
rm tests/__init__.py
78-
pycodestyle openedx_authz tests manage.py setup.py
79+
ruff check openedx_authz tests test_utils manage.py setup.py
7980
pydocstyle openedx_authz tests manage.py setup.py
80-
isort --check-only --diff tests test_utils openedx_authz manage.py setup.py
8181
make selfcheck
8282

8383
[testenv:pii_check]

0 commit comments

Comments
 (0)