diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a206a88..a00cca8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b394d41..4619366 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 ] diff --git a/example/urls.py b/example/urls.py index 9ab26d6..9cfb745 100644 --- a/example/urls.py +++ b/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 @@ -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() diff --git a/tests/test_urls.py b/tests/test_urls.py index 4bce3ed..7666035 100644 --- a/tests/test_urls.py +++ b/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'), ]