Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/workflows/pre-commit.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/prek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: prek checks

on:
pull_request:
push:
branches: [main]

jobs:
prek:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: j178/[email protected]
22 changes: 15 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v6.0.0"
rev: v6.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=1024"]
Expand All @@ -27,39 +27,47 @@ repos:
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: "v3.21.0"
rev: v3.21.0
hooks:
- id: pyupgrade
args: [--py312]

- repo: https://github.com/adamchainz/django-upgrade
rev: "1.29.1"
rev: 1.29.1
hooks:
- id: django-upgrade
args: [--target-version, "5.2"]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.9.0
hooks:
- id: black

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.6.2"
rev: v3.6.2
hooks:
- id: prettier
exclude_types: [html, json, scss]
exclude: '(^djangoproject\/static\/js\/lib\/.*$)'

- repo: https://github.com/pycqa/isort
rev: "7.0.0"
rev: 7.0.0
hooks:
- id: isort

- repo: https://github.com/pycqa/flake8
rev: "7.3.0"
rev: 7.3.0
hooks:
- id: flake8

- repo: https://github.com/rtts/djhtml
rev: "3.0.10"
rev: 3.0.10
hooks:
- id: djhtml
files: .*/templates/.*\.html$

- repo: https://github.com/mrtazz/checkmake.git
rev: 0.2.2
hooks:
Expand Down
30 changes: 12 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -370,26 +370,20 @@ Running Locally with Docker

7. View the docs at http://docs.djangoproject.localhost:8000/.

Pre-commit checks
-----------------
git hooks
---------
`pre-commit <https://pre-commit.com>`_ is a framework to run hooks written in many languages, and it manages the language toolchain and dependencies for running the hooks.

`pre-commit <https://pre-commit.com>`_ is a framework for managing pre-commit
hooks. These hooks help to identify simple issues before committing code for
review. By checking for these issues before code review it allows the reviewer
to focus on the change itself, and it can also help to reduce the number of CI
runs.
prek is a reimagined version of pre-commit, built in Rust. It is designed to be a faster, dependency-free and drop-in alternative for it, while also providing some additional long-requested features.

To use the tool, first install ``pre-commit`` and then the git hooks
\- quoted from `prek's README.md <https://github.com/j178/prek/blob/ee7110b49bb1aa8d7b3ccee51c5241550cb0aec2/README.md>`_

.. code-block:: console
To use git hooks locally, first install ``prek`` and then the git hooks:

$ python3 -m pip install pre-commit
$ python3 -m pre_commit install
* Depending on your choice of platform and tooling, you can use the related installation instructions from https://prek.j178.dev/installation/
* Install git hooks using ``prek install`` command: https://prek.j178.dev/cli/#prek-install

On the first commit ``pre-commit`` will install the hooks, these are
installed in their own environments and will take a short while to
install on the first run. Subsequent checks will be significantly faster.
If the an error is found an appropriate error message will be displayed.
If the error was with ``isort`` then the tool will go ahead and fix them for
you. Review the changes and re-stage for commit if you are happy with
them.
The installed hooks will be triggered during each commit, or can be manually triggered via
``prek run`` command: https://prek.j178.dev/cli/#prek-run If an error is found an appropriate
error message will be displayed. If the error was with ``isort`` then the tool will go ahead
and fix them for you. Review the changes and re-stage for commit if you are happy with them.
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r common.txt
black==25.9.0 # Used by Django's find_formatters and run_formatters
django-debug-toolbar==6.0.0
pre-commit~=4.3.0
prek==0.2.5
psycopg[binary]==3.2.10
watchdog==6.0.0