2021-06-08 15:54:38 -04:00
|
|
|
# pre-commit
|
|
|
|
|
|
|
|
To use `typos` with [`pre-commit`](https://pre-commit.com), point its
|
|
|
|
config at this repository:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
repos:
|
|
|
|
- repo: https://github.com/crate-ci/typos
|
2023-10-02 11:27:24 -04:00
|
|
|
rev: v1.16.16
|
2021-06-08 15:54:38 -04:00
|
|
|
hooks:
|
|
|
|
- id: typos
|
|
|
|
```
|
|
|
|
|
2021-06-28 12:36:56 -04:00
|
|
|
The `typos` id installs a prebuilt executable from GitHub releases. If
|
|
|
|
one does not exist for the target platform, or if one built from
|
2022-12-18 09:53:06 -05:00
|
|
|
sources is preferred, use `typos-docker` (requires Docker), or `typos-src`
|
|
|
|
(requires Rust) as the hook id instead.
|
2021-06-28 12:36:56 -04:00
|
|
|
|
2021-06-08 15:54:38 -04:00
|
|
|
Be sure to change `rev` to use the desired `typos` git tag or
|
|
|
|
revision.
|
|
|
|
|
|
|
|
The hook configuration defaults to writing fixes, which triggers a
|
|
|
|
`pre-commit` failure if any files are modified. To make it report its
|
|
|
|
findings only instead, override the hook's `args` with something that
|
|
|
|
does not contain `-w`/`--write-changes`, for example `[]` (meaning
|
|
|
|
pass no options).
|