Skip to content

Commit

Permalink
Feature/django upgrade linter (#321)
Browse files Browse the repository at this point in the history
* Updated badges in Readme.rst

* Added "django-upgrade" linter and updated ruff version to 0.4.0

* CI changes
  • Loading branch information
GitRon committed Apr 19, 2024
1 parent 5df561b commit fb5e1bc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -18,10 +18,10 @@ jobs:
python-version: "3.12"

- name: Install required packages
run: pip install ruff
run: pip install pre-commit

- name: Run linter "Ruff"
run: ruff .
- name: Run linters
run: pre-commit run --all-files --hook-stage push

build:
name: Python ${{ matrix.python-version }}, django ${{ matrix.django-version }}
Expand Down
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Expand Up @@ -3,8 +3,16 @@

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.4.0
hooks:
# Run the Ruff linter.
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/adamchainz/django-upgrade
rev: 1.16.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
language_version: python3.12
stages: [ push ]
16 changes: 8 additions & 8 deletions example/urls.py
@@ -1,6 +1,6 @@
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include, re_path
from django.urls import include, path

from django_ses.views import SESEventWebhookView
from example import views
Expand All @@ -9,15 +9,15 @@

urlpatterns = [
'',
re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')),
re_path(r'^admin/', include(admin.site.urls)),
path('admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/', include(admin.site.urls)),

re_path(r'^$', views.index, name='index'),
re_path(r'^send-email/$', views.send_email, name='send-email'),
re_path(r'^reporting/', include('django_ses.urls')),
path('', views.index, name='index'),
path('send-email/', views.send_email, name='send-email'),
path('reporting/', include('django_ses.urls')),

re_path(r'^bounce/', 'django_ses.views.handle_bounce', name='handle_bounce'), # Deprecated, see SESEventWebhookView
re_path(r'^event-webhook/', SESEventWebhookView.as_view(), name='event_webhook'),
path('bounce/', 'django_ses.views.handle_bounce', name='handle_bounce'), # Deprecated, see SESEventWebhookView
path('event-webhook/', SESEventWebhookView.as_view(), name='event_webhook'),
]

urlpatterns += staticfiles_urlpatterns()
8 changes: 4 additions & 4 deletions tests/test_urls.py
@@ -1,9 +1,9 @@
from django.urls import re_path
from django.urls import path

from django_ses.views import DashboardView, SESEventWebhookView, handle_bounce

urlpatterns = [
re_path(r'^dashboard/$', DashboardView.as_view(), name='django_ses_stats'),
re_path(r'^bounce/$', handle_bounce, name='django_ses_bounce'),
re_path(r'^event-webhook/$', SESEventWebhookView.as_view(), name='event_webhook'),
path('dashboard/', DashboardView.as_view(), name='django_ses_stats'),
path('bounce/', handle_bounce, name='django_ses_bounce'),
path('event-webhook/', SESEventWebhookView.as_view(), name='event_webhook'),
]

0 comments on commit fb5e1bc

Please sign in to comment.