This is guide of using Lefthook git hook manager in Ruby projects. You can find guides for other environments in README.md.
gem install lefthookCreate and edit lefthook.yml:
pre-commit:
parallel: true
commands:
audit:
run: brakeman --no-pager
rubocop:
files: git diff --name-only --staged
glob: "*.rb"
run: rubocop --force-exclusion {files}lefthook install && lefthook run pre-commitIf you see the error lefthook: command not found you need to check your $PATH. Also try to restart your terminal.
Have a question? Check the wiki.