Skip to content

Commit b1fdc9a

Browse files
authored
Improve pre-commit configuration hooks (#1645)
1 parent d786988 commit b1fdc9a

28 files changed

+39
-65
lines changed

.pre-commit-config.yaml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,50 @@
1-
exclude: '(\/migrations\/|^djangoproject\/static\/.*$)'
1+
exclude: '(^djangoproject\/static\/.*$)'
22
default_language_version:
33
python: python3
44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: "v4.6.0"
6+
rev: "v5.0.0"
77
hooks:
8+
- id: check-added-large-files
9+
args: ["--maxkb=1024"]
10+
- id: check-case-conflict
11+
- id: check-docstring-first
12+
- id: check-executables-have-shebangs
13+
- id: check-json
14+
- id: check-merge-conflict
15+
- id: check-shebang-scripts-are-executable
16+
- id: check-toml
17+
- id: check-yaml
18+
args: ["--allow-multiple-documents"]
819
- id: debug-statements
920
- id: detect-private-key
1021
- id: end-of-file-fixer
1122
exclude_types: [json, sql]
1223
- id: file-contents-sorter
1324
files: ^(requirements/\w*.txt)$
1425
args: ["--ignore-case", "--unique"]
15-
- id: fix-encoding-pragma
16-
args: ["--remove"]
26+
- id: fix-byte-order-marker
27+
- id: mixed-line-ending
1728
- id: trailing-whitespace
1829
- repo: https://github.com/asottile/pyupgrade
19-
rev: "v3.17.0"
30+
rev: "v3.19.0"
2031
hooks:
2132
- id: pyupgrade
2233
# TODO: Update to --py312 when dropping support for
2334
# Python 3.8
2435
args: [--py38-plus]
2536
- repo: https://github.com/adamchainz/django-upgrade
26-
rev: "1.21.0"
37+
rev: "1.22.1"
2738
hooks:
2839
- id: django-upgrade
2940
args: [--target-version, "4.2"]
3041
- repo: https://github.com/psf/black
31-
rev: 24.8.0
42+
rev: 24.10.0
3243
hooks:
3344
- id: black
34-
- repo: https://github.com/pre-commit/mirrors-prettier
35-
rev: "v4.0.0-alpha.8"
45+
exclude: '(\/migrations\/)'
46+
- repo: https://github.com/rbubley/mirrors-prettier
47+
rev: "v3.3.3"
3648
hooks:
3749
- id: prettier
3850
exclude_types: [html, json, scss]
@@ -45,7 +57,15 @@ repos:
4557
hooks:
4658
- id: flake8
4759
- repo: https://github.com/rtts/djhtml
48-
rev: "3.0.6"
60+
rev: "3.0.7"
4961
hooks:
5062
- id: djhtml
5163
files: .*/templates/.*\.html$
64+
- repo: https://github.com/tox-dev/pyproject-fmt
65+
rev: "2.4.3"
66+
hooks:
67+
- id: pyproject-fmt
68+
- repo: https://github.com/mrtazz/checkmake.git
69+
rev: 0.2.2
70+
hooks:
71+
- id: checkmake

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SCSS = djangoproject/scss
33
JQUERY_FLOT=djangoproject/static/js/lib/jquery-flot
44
APP_LIST ?= accounts aggregator blog contact dashboard djangoproject docs foundation fundraising legacy members releases svntogit tracdb
55

6-
.PHONY: collectstatics compile-scss compile-scss-debug watch-scss run install test ci
6+
.PHONY: all ci clean collectstatics compile-scss compile-scss-debug install run test watch-scss
77

88
collectstatics: compile-scss
99
python -m manage collectstatic --noinput
@@ -28,7 +28,7 @@ migrations-check:
2828
python -m manage makemigrations --check --dry-run
2929

3030
test: migrations-check
31-
@python -m coverage run --source=. manage.py test -v2 $(APP_LIST)
31+
@python -m coverage run --source=. -m manage test -v2 $(APP_LIST)
3232

3333
ci: test
3434
@python -m coverage report

accounts/migrations/0001_initial.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.conf import settings
52
from django.db import migrations, models
63

aggregator/migrations/0001_initial.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.conf import settings
52
from django.db import migrations, models
63

aggregator/migrations/0002_add_feed_approver_auth_group.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.conf import settings
52
from django.db import migrations
63

blog/migrations/0001_initial.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import migrations, models
52

63

blog/migrations/0002_event.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import migrations, models
52

63

dashboard/migrations/0001_initial.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
import datetime
52

63
import django.db.models.deletion

djangoproject/scss/_utils.scss

100755100644
File mode changed.

djangoproject/scss/output.scss

100755100644
File mode changed.

0 commit comments

Comments
 (0)