Skip to content

Commit

Permalink
Add linting to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Mar 8, 2024
1 parent 058b94c commit 3ecea39
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
matrix:
toxenv:
- isort
- black
- flake8
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
4 changes: 2 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os
import sys

if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'testsettings')
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testsettings")

from django.core.management import execute_from_command_line

Expand Down
17 changes: 9 additions & 8 deletions testsettings.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}

ALLOWED_HOSTS = ['example.com',]
ALLOWED_HOSTS = [
"example.com",
]

INSTALLED_APPS = [
'django.contrib.sites',
'regex_redirects',
"django.contrib.sites",
"regex_redirects",
]

SECRET_KEY = "notimportant"

APPEND_SLASH = False

MIDDLEWARE = ['regex_redirects.middleware.RedirectFallbackMiddleware']
MIDDLEWARE = ["regex_redirects.middleware.RedirectFallbackMiddleware"]

SITE_ID = 1

Expand Down
17 changes: 17 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ envlist =
py{38,39,310}-django{32,42}
py3{11,12}-django{41,42}
isort
black
flake8
skip_missing_interpreters = true

[gh-actions]
Expand All @@ -24,3 +26,18 @@ deps=
django42: Django~=4.2.0
commands =
python manage.py test regex_redirects

[testenv:isort]
extras = tests
skipsdist = True
commands = isort --check-only --diff .

[testenv:black]
extras = tests
skipsdist = True
commands = black --check regex_redirects testsettings.py manage.py

[testenv:flake8]
extras = tests
skipsdist = True
commands = flake8 .

0 comments on commit 3ecea39

Please sign in to comment.