This is the guide to use the Lefthook git hook manager in any environment. You can find guides for Ruby and Node.js in README.md.
Add Lefthook to your system or build it from source.
go get github.com/evilmartians/lefthook
brew install lefthook
snap install --classic lefthook
curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.deb.sh' | sudo -E bash
sudo apt install lefthook
See all instructions: https://cloudsmith.io/~evilmartians/repos/lefthook/setup/#formats-deb
curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.rpm.sh' | sudo -E bash
sudo yum install lefthook
See all instructions: https://cloudsmith.io/~evilmartians/repos/lefthook/setup/#repository-setup-yum
You can install lefthook package from AUR
Or take it from binaries and install manually
You can find Python wrapper here package
Create and edit lefthook.yml
:
pre-commit:
parallel: true
commands:
audit:
run: brakeman --no-pager
rubocop:
files: git diff --name-only @{push}
glob: "*.rb"
run: rubocop {files}
lefthook install && lefthook run pre-commit
Have a question? Check the wiki.