Skip to content

Commit 72df3d4

Browse files
committed
Migrate from flake8 -> ruff
1 parent 8da55cc commit 72df3d4

File tree

6 files changed

+60
-70
lines changed

6 files changed

+60
-70
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ jobs:
3131
uses: actions/setup-python@v4
3232
with:
3333
python-version: ${{ matrix.python-version }}
34+
- name: Check with ruff
35+
uses: jpetrucciani/ruff-check@main
36+
with:
37+
path: "ajax_select"
3438
- name: Install dependencies
3539
run: |
36-
python -m pip install --upgrade flake8
37-
python -m pip install --upgrade pip
38-
python -m pip install tox tox-gh-actions
40+
python -m pip install ruff tox tox-gh-actions
3941
- name: Test with tox
4042
run: tox

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ and include jquery and jquery-ui yourself, making sure they are loaded before th
145145
## Compatibility
146146

147147
* Django >=3.2
148-
* Python >=3.8
148+
* Python >=3.10
149149

150150
## Contributors
151151

ajax_select/admin.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class AjaxSelectAdmin(admin.ModelAdmin):
7-
""" in order to get + popup functions subclass this or do the same hook inside of your get_form """
7+
"""in order to get + popup functions subclass this or do the same hook inside of your get_form"""
88

99
def get_form(self, request, obj=None, **kwargs):
1010
form = super().get_form(request, obj, **kwargs)
@@ -14,16 +14,19 @@ def get_form(self, request, obj=None, **kwargs):
1414

1515

1616
class AjaxSelectAdminInlineFormsetMixin:
17-
1817
def get_formset(self, request, obj=None, **kwargs):
1918
fs = super().get_formset(request, obj, **kwargs)
2019
autoselect_fields_check_can_add(fs.form, self.model, request.user)
2120
return fs
2221

2322

24-
class AjaxSelectAdminTabularInline(AjaxSelectAdminInlineFormsetMixin, admin.TabularInline):
23+
class AjaxSelectAdminTabularInline(
24+
AjaxSelectAdminInlineFormsetMixin, admin.TabularInline
25+
):
2526
pass
2627

2728

28-
class AjaxSelectAdminStackedInline(AjaxSelectAdminInlineFormsetMixin, admin.StackedInline):
29+
class AjaxSelectAdminStackedInline(
30+
AjaxSelectAdminInlineFormsetMixin, admin.StackedInline
31+
):
2932
pass

poetry.lock

Lines changed: 28 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,27 @@ Django = ">=3.2"
2727

2828
[tool.poetry.group.dev.dependencies]
2929
tox = "^4.11.4"
30-
flake8 = "^6.1.0"
3130
sphinx = "^7.2.6"
3231
sphinx-rtd-theme = "^2.0.0"
32+
ruff = "^0.1.7"
33+
34+
[tool.ruff]
35+
exclude = [
36+
"./example/AJAXSELECTS/lib/*",
37+
"./example/AJAXSELECTS/bin/*",
38+
"./docs/*",
39+
]
40+
ignore = []
41+
line-length = 120
42+
select = [
43+
"C9",
44+
"E",
45+
"F",
46+
"W",
47+
]
48+
49+
[tool.ruff.mccabe]
50+
max-complexity = 10
3351

3452
[build-system]
3553
requires = ["poetry-core"]

tox.ini

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
;
77
[tox]
88
envlist =
9-
{py312}-flake8,
109
{py310,py311}-{dj32,dj42}
1110
{py312}-{dj40,dj41,dj42,dj50}
1211

@@ -30,9 +29,3 @@ deps =
3029
dj42: Django>=4,<5
3130
dj50: Django>=5.0,<6
3231
; djmaster: https://github.com/django/django/zipball/master
33-
34-
[testenv:py12-flake8]
35-
deps =
36-
flake8
37-
commands = flake8 ajax_select tests example
38-

0 commit comments

Comments
 (0)