Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a more self-contained pre-commit hook #155

Merged
Merged
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
7 changes: 7 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
entry: scripts/pre-commit.sh
language: 'script'
description: "Runs `woke`"
- id: woke-from-source
name: 'woke'
entry: woke
args: [--exit-1-on-failure]
# The 'go' binary on your path must be at least version 1.17.
language: 'golang'
description: "Runs `woke`, building it from source on demand"
37 changes: 37 additions & 0 deletions docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,40 @@
- [GitHub Action (reviewdog)](https://github.com/marketplace/actions/run-woke-with-reviewdog)
- [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=get-woke.vscode-woke)
- [VIM Plugin](https://github.com/get-woke/vim-woke)

## Pre-commit hook

`woke` supports being run from a [pre-commit](https://pre-commit.com/) hook,
allowing you to avoid accidentally committing uses of non-inclusive
language.
You have two alternative mechanisms for doing so.
If you have arranged to install `woke` on your command search path (as well
as anyone working on your repository), then add this configuration to your
`.pre-commit-config.yaml`:

```yaml
- repo: https://github.com/get-woke/woke
rev: '' # pick a tag to point to
hooks:
- woke
```

(Note that in this case the `rev` only controls the version of a wrapper
script that is used, not the version of `woke` itself.)

Alternatively, you can tell `pre-commit` to build `woke` from source,
although this requires you and anyone working on your repository to have
`go` on your command search path and for it to be at least version 1.17:

```yaml
- repo: https://github.com/get-woke/woke
rev: '' # pick a tag to point to
hooks:
- woke-from-source
```

(In this case the `rev` controls the version of `woke` itself.)

See the [pre-commit
documentation](https://pre-commit.com/#pre-commit-configyaml---hooks) for
how to customize this further.