You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7d794bd
Browse filesBrowse the repository at this point in the historyBrowse files
Swap out references to pre-commit with prek (#645)
This PR removes the repos reliance on `pre-commit` in favour of `prek`.
`prek` is faster, has a welcoming community, and is the future of
linting. `prek` supports `.pre-commit-config.yaml` so no need to change
anything really, and in the future we could consider moving towards its
custom `prek.toml` format.
As part of this work I have uninstalled @pre-commit-ci. We weren't
configuring it any more (i.e. no `ci:` block in
`.pre-commit-config.yaml`) and it was causing bugs #644.
Fixes#644.
|[pre-commit.ci](https://pre-commit.ci/)| A bot that adds a pre-commit job to your GitHub Actions CI, and can automatically fix most trivial linting failures. Free for open-source projects. | <spanclass="label label-green">Best</span>|
14
+
|[pre-commit.ci](https://pre-commit.ci/)| A bot that adds a pre-commit job to your GitHub Actions CI, and can automatically fix most trivial linting failures. Free for open-source projects. | <spanclass="label label-yellow">Good</span> |
We have many projects using GitHub CI and, it has good integration with GitHub itself, and is free for public repositories (with limited free monthly minutes for private repositories).
|[pre-commit](https://pre-commit.com/)| Universal tool which performs a git hook on commit, allows you to run linters/formatters on any code. A tool to automatically run many of the tools listed below. | <spanclass="label label-green">Best</span> |
16
+
|[prek](https://prek.j178.dev/)| A rust-powered improvement on `pre-commit`. Known for its friendlier community and feature rich implementation. | <spanclass="label label-green">Best</span> |
17
+
|[pre-commit](https://pre-commit.com/)| Universal tool which performs a git hook on commit, allows you to run linters/formatters on any code. A tool to automatically run many of the tools listed below. | <spanclass="label label-yellow">Good</span> |
17
18
|[ruff-format](https://github.com/astral-sh/ruff)| A drop-in replacement for `black` (and also super fast). A nice "no-need to think" code formatter. If you have your own opinions about code style, you might not like this. | <spanclass="label label-green">Best</span> |
18
19
|[ruff](https://github.com/astral-sh/ruff)| A fast linter which incorporates a range of other linters. Notably [isort](https://pycqa.github.io/isort/) can be included as a [ruff rule](https://docs.astral.sh/ruff/rules/) (which we recommend). | <spanclass="label label-green">Best</span> |
19
20
|[toml-sort](https://github.com/pappasam/toml-sort)| Sorts TOML files which are now part of PEP 8. | <spanclass="label label-green">Best</span> |
Copy file name to clipboardExpand all lines: docs/pages/tutorial.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -396,33 +396,33 @@ tox -e docs
396
396
from the root of the project repository.
397
397
The built documentation will be output to a directory `site`.
398
398
399
-
## ✅ Using `pre-commit` to run checks when committing
399
+
## ✅ Using `prek` to run checks when committing
400
400
401
-
The package is set-up to use [pre-commit](https://pre-commit.com/), a framework for running [Git hook scripts](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) on each commit to the repository.
401
+
The package is set-up to use [prek](https://prek.j178.dev/), a framework for running [Git hook scripts](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) on each commit to the repository.
402
402
403
403
There is a `.pre-commit-config.yaml` configuration file which you can take a look at.
404
-
With this setup `pre-commit` will run a series of fast linters, checks and formatters on the repository on every commit.
404
+
With this setup `prek` will run a series of fast linters, checks and formatters on the repository on every commit.
405
405
406
406
The main tools we recommend are [ruff](https://docs.astral.sh/ruff/), [ty](https://docs.astral.sh/ty/) and [prettier](https://prettier.io/).
407
407
These Git hook scripts can be installed locally by running
408
408
409
409
```sh
410
-
pre-commit install
410
+
prek install
411
411
```
412
412
413
413
from the root of the project repository.
414
414
You will only need to do this once per `git clone` of the code.
415
415
416
416
Once installed, the scripts will be called to inspect the changes each time `git commit` is run.
417
417
Any failures of the checks will need to be fixed before the changes can be committed.
418
-
Some of the `pre-commit` hooks include support for auto-fixing easy problems - in this case you will be alerted that a file has been changed by a hook and these changes need to be staged using `git add` before recommitting.
418
+
Some of the `prek` hooks include support for auto-fixing easy problems - in this case you will be alerted that a file has been changed by a hook and these changes need to be staged using `git add` before recommitting.
419
419
420
420
The hooks typically only run on the files _changed_ in a commit.
421
-
The `pre-commit` hooks can be run against _all files in the repository_ by running
421
+
The `prek` hooks can be run against _all files in the repository_ by running
422
422
423
423
```sh
424
-
pre-commit run --all-files
424
+
prek run --all-files
425
425
```
426
426
427
427
from the root of the project repository.
428
-
This is useful to check they will pass if the `pre-commit` configuration is updated, for example, when [adding a new plug-in](https://pre-commit.com/#plugins).
428
+
This is useful to check they will pass if the `prek` configuration is updated, for example, when [adding a new plug-in](https://prek.j178.dev/authoring-hooks).
0 commit comments