Add a more self-contained pre-commit hook #155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
New alternative
pre-commit
hook, and corresponding documentation.What is the current behavior? (You can also link to an open issue here)
The previous
pre-commit
hook declaration, usinglanguage: 'script'
, relied onwoke
already being installed on the user's path, which is a somewhat awkward requirement compared to most otherpre-commit
hooks which tend to be self-contained. It also meant that it wasn't possible to pinwoke
to a particular version on a per-repository basis using something likerev: v0.15.0
.What is the new behavior (if this is a feature change)?
Using
language: 'golang'
instead means thatpre-commit
builds a self-contained installation ofwoke
for itself. The only downside is that thego
binary on the user's path must be at least version 1.17, which can be a bit annoying (for example, on Ubuntu 20.04 it requires using something like thego
snap rather than the .deb). However, this will become less of a problem over time.In order to avoid a breaking change for people already using the old approach, I added this as a new alternative hook, called
woke-from-source
.Add documentation for all this.
Does this PR introduce a breaking change? (What changes might users need to make due to this PR?)
No - the previous hook is left unchanged. Users may wish to migrate to the new hook if it fits their needs better.
This is an alternative to #152.