mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
Merge pull request #282 from scop/feat/pre-commit-integration
feat: Add pre-commit integration
This commit is contained in:
commit
0be066fb06
4 changed files with 31 additions and 0 deletions
7
.pre-commit-hooks.yaml
Normal file
7
.pre-commit-hooks.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
- id: typos
|
||||
name: typos
|
||||
description: Source code spell checker
|
||||
language: rust
|
||||
entry: typos
|
||||
args: [--write-changes]
|
||||
types: [text]
|
|
@ -37,6 +37,7 @@ pre-release-replacements = [
|
|||
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
|
||||
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/assert-rs/predicates-rs/compare/{{tag_name}}...HEAD", exactly=1},
|
||||
{file="docker/Dockerfile", search="ARG VERSION=.*", replace="ARG VERSION={{version}}", min=1},
|
||||
{file="docs/pre-commit.md", search="rev: .*", replace="rev: {{tag_name}}", exactly=1},
|
||||
]
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -23,6 +23,7 @@ Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE)
|
|||
- [False Positives](#false-positives)
|
||||
- [Integrations](#integrations)
|
||||
- [GitHub Action](docs/github-action.md)
|
||||
- [pre-commit](docs/pre-commit.md)
|
||||
- [Custom](#custom)
|
||||
- [Debugging](#debugging)
|
||||
- [Reference](docs/reference.md)
|
||||
|
@ -87,6 +88,7 @@ extend-exclude = ["localized/*.po"]
|
|||
### Integrations
|
||||
|
||||
- [GitHub Actions](docs/github-action.md)
|
||||
- [pre-commit](docs/pre-commit.md)
|
||||
|
||||
#### Custom
|
||||
|
||||
|
|
21
docs/pre-commit.md
Normal file
21
docs/pre-commit.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# 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
|
||||
rev: v1.0.6
|
||||
hooks:
|
||||
- id: typos
|
||||
```
|
||||
|
||||
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).
|
Loading…
Reference in a new issue