Skip to content

Commit 3ecea39

Browse files
committed
Add linting to CI
1 parent 058b94c commit 3ecea39

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

.github/workflows/code-quality.yml

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
matrix:
2323
toxenv:
2424
- isort
25+
- black
26+
- flake8
2527
steps:
2628
- uses: actions/checkout@v4
2729
- uses: actions/setup-python@v5

manage.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import os
33
import sys
44

5-
if __name__ == '__main__':
6-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'testsettings')
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testsettings")
77

88
from django.core.management import execute_from_command_line
99

testsettings.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
21
DATABASES = {
3-
'default': {
4-
'ENGINE': 'django.db.backends.sqlite3',
5-
'NAME': ':memory:',
2+
"default": {
3+
"ENGINE": "django.db.backends.sqlite3",
4+
"NAME": ":memory:",
65
}
76
}
87

9-
ALLOWED_HOSTS = ['example.com',]
8+
ALLOWED_HOSTS = [
9+
"example.com",
10+
]
1011

1112
INSTALLED_APPS = [
12-
'django.contrib.sites',
13-
'regex_redirects',
13+
"django.contrib.sites",
14+
"regex_redirects",
1415
]
1516

1617
SECRET_KEY = "notimportant"
1718

1819
APPEND_SLASH = False
1920

20-
MIDDLEWARE = ['regex_redirects.middleware.RedirectFallbackMiddleware']
21+
MIDDLEWARE = ["regex_redirects.middleware.RedirectFallbackMiddleware"]
2122

2223
SITE_ID = 1
2324

tox.ini

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ envlist =
33
py{38,39,310}-django{32,42}
44
py3{11,12}-django{41,42}
55
isort
6+
black
7+
flake8
68
skip_missing_interpreters = true
79

810
[gh-actions]
@@ -24,3 +26,18 @@ deps=
2426
django42: Django~=4.2.0
2527
commands =
2628
python manage.py test regex_redirects
29+
30+
[testenv:isort]
31+
extras = tests
32+
skipsdist = True
33+
commands = isort --check-only --diff .
34+
35+
[testenv:black]
36+
extras = tests
37+
skipsdist = True
38+
commands = black --check regex_redirects testsettings.py manage.py
39+
40+
[testenv:flake8]
41+
extras = tests
42+
skipsdist = True
43+
commands = flake8 .

0 commit comments

Comments
 (0)