Skip to content

Instantly share code, notes, and snippets.

@trekdemo
Last active November 23, 2016 18:53
Show Gist options
  • Save trekdemo/be52b6bfe217bc31077d0f14eaf032d7 to your computer and use it in GitHub Desktop.
Save trekdemo/be52b6bfe217bc31077d0f14eaf032d7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Put this file into your .git/hooks directory and make it
# executable.
#
# A hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook exits
# with non-zero status if the Rubocop check fails.
# Redirect output to stderr.
exec 1>&2
git diff --cached --name-only | grep '\.rb' | xargs rubocop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment