Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 760 Bytes

ruby.md

File metadata and controls

36 lines (27 loc) · 760 Bytes

Lefthook in Ruby

This is guide of using Lefthook git hook manager in Ruby projects. You can find guides for other environments in README.md.

Install

gem install lefthook

Edit

Create 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}

Test it

lefthook install && lefthook run pre-commit

Troubleshooting

If you see the error lefthook: command not found you need to check your $PATH. Also try to restart your terminal.

More info

Have a question? Check the wiki.