Skip to content
Draft
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
5 changes: 1 addition & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ jobs:

steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
- uses: j178/prek-action@v1
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ _ensure-package: venv
$(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \
fi

.PHONY: _ensure-pre-commit
_ensure-pre-commit:
make _ensure-package PACKAGE=pre-commit
.PHONY: _ensure-prek
_ensure-prek:
make _ensure-package PACKAGE=prek

.PHONY: lint
lint: _ensure-pre-commit
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
lint: _ensure-prek
$(VENVDIR)/bin/python3 -m prek run --all-files

# Generate all release cycle files together with a single script invocation
# Use branches.csv as the primary target, others depend on it
Expand Down
2 changes: 1 addition & 1 deletion getting-started/pull-request-lifecycle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ You should have already :ref:`set up your system <setup>`,

(Learn more about :ref:`good-commits`)

* If your code isn't linted correctly, :ref:`pre-commit <install-pre-commit>`
* If your code isn't linted correctly, :ref:`prek <install-prek>`
will block the commit with an error message, for example::

Doc/library/stdtypes.rst:5718: No newline at end of file. (missing-final-newline)
Expand Down
14 changes: 7 additions & 7 deletions getting-started/setup-building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ affected files as described below.)
Changes for the documentation can be made from the same repository; see
:ref:`documenting`.

.. _install-pre-commit:
.. _install-prek:

Install pre-commit as a Git hook
--------------------------------
Install prek as a Git hook
--------------------------

To make sure your code is linted correctly, we recommend setting up
`pre-commit <https://pre-commit.com#installation>`__ as a Git hook::
`prek <https://prek.j178.dev/installation/>`__ as a Git hook::

$ pre-commit install --allow-missing-config
pre-commit installed at .git/hooks/pre-commit
$ prek install --allow-missing-config
prek installed at .git/hooks/pre-commit

Now pre-commit will run automatically on ``git commit``.
Now prek will run automatically on ``git commit``.

.. c_get_source_code_end
Expand Down
Loading