Husky
Git hooks made easy
Description
Husky is an exlir version of the husky npm module.
Husky can prevent bad git commit, git push and more 🐶 ❤️ woof!
Installation
The Husky Hex package can be installed
by adding husky to your list of dependencies in mix.exs:
defp deps do
[
{:husky, "~> 0.1.5"}
]
endUsage
-
Run
mix husky.installto install husky git hook scripts -
Configure git hook commands in either your
config/config.exsor a.husky.jsonfile- Note:
config/config.exswill take precedence over.husky.jsonif there are key conflicts
- Note:
-
Remove git hook scripts
mix husky.delete
Configure Git Hooks Using config/config.exs:
use Mix.Config
config :husky,
pre_commit: "mix format",
pre_push: "mix test"View example file config.example.exs
Configure Git Hooks Using .husky.json:
{
"husky": {
"hooks": {
"pre_commit": "mix format",
"pre_push": "mix test"
}
}
}View example file .husky.example.json
Documentation can found at https://hexdocs.pm/husky.