Skip to content

Commit ed57bbf

Browse files
committed
Run django-upgrade and linting on CI
1 parent ea671db commit ed57bbf

File tree

5 files changed

+61
-5
lines changed

5 files changed

+61
-5
lines changed

.github/workflows/lint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lint
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions: {}
6+
7+
env:
8+
FORCE_COLOR: 1
9+
RUFF_OUTPUT_FORMAT: github
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v6
17+
with:
18+
persist-credentials: false
19+
- uses: actions/setup-python@v6
20+
with:
21+
python-version: "3.x"
22+
- uses: j178/prek-action@v1

.pre-commit-config.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
repos:
2+
- repo: https://github.com/adamchainz/django-upgrade
3+
rev: 1.29.1
4+
hooks:
5+
- id: django-upgrade
6+
args: [--target-version=4.2]
7+
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v6.0.0
10+
hooks:
11+
- id: check-case-conflict
12+
- id: check-merge-conflict
13+
- id: check-json
14+
- id: check-yaml
15+
- id: debug-statements
16+
17+
- repo: https://github.com/python-jsonschema/check-jsonschema
18+
rev: 0.34.0
19+
hooks:
20+
- id: check-dependabot
21+
- id: check-github-workflows
22+
23+
- repo: https://github.com/rhysd/actionlint
24+
rev: v1.7.7
25+
hooks:
26+
- id: actionlint
27+
28+
- repo: meta
29+
hooks:
30+
- id: check-hooks-apply
31+
- id: check-useless-excludes
32+
33+
ci:
34+
autoupdate_schedule: quarterly

pydotorg/urls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
path('', views.IndexView.as_view(), name='home'),
2020
re_path(r'^_health/?', views.health, name='health'),
2121
path('authenticated', views.AuthenticatedView.as_view(), name='authenticated'),
22-
re_path(r'^humans.txt$', TemplateView.as_view(template_name='humans.txt', content_type='text/plain')),
23-
re_path(r'^robots.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
24-
re_path(r'^funding.json$', views.serve_funding_json, name='funding_json'),
22+
path('humans.txt', TemplateView.as_view(template_name='humans.txt', content_type='text/plain')),
23+
path('robots.txt', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
24+
path('funding.json', views.serve_funding_json, name='funding_json'),
2525
path('shell/', TemplateView.as_view(template_name="python/shell.html"), name='shell'),
2626

2727
# python section landing pages

sponsors/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def get_prepopulated_fields(self, request, obj=None):
201201
return {'slug': ['name']}
202202
return {}
203203

204+
@admin.display(description="Revenue split")
204205
def get_benefit_split(self, obj: SponsorshipPackage) -> str:
205206
colors = [
206207
"#ffde57", # Python Gold
@@ -223,7 +224,6 @@ def get_benefit_split(self, obj: SponsorshipPackage) -> str:
223224
html = f"<div style='{style}'>{''.join(spans)}</div>"
224225
return mark_safe(html)
225226

226-
get_benefit_split.short_description = "Revenue split"
227227

228228

229229
class SponsorContactInline(admin.TabularInline):

successstories/tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_draft(self):
2121
def test_featured(self):
2222
featured_stories = Story.objects.featured()
2323
expected_repr = [f'<Story: {self.story3.name}>']
24-
self.assertQuerysetEqual(featured_stories, expected_repr, transform=repr)
24+
self.assertQuerySetEqual(featured_stories, expected_repr, transform=repr)
2525

2626
def test_get_admin_url(self):
2727
self.assertEqual(self.story1.get_admin_url(),

0 commit comments

Comments
 (0)