Skip to content

Instantly share code, notes, and snippets.

@app2641
Created Feb 21, 2017
Embed
What would you like to do?
.git/hooks/pre-commit
#! /bin/sh
git df --cached --name-only --diff-filter=AM | grep '\.rb$' | grep -v 'db/schema.rb' | xargs bundle exec rubocop -c .rubocop.yml
RUBOCOP=$?
git df --cached --name-only --diff-filter=AM | grep '\.js$' | xargs npm run lint
ESLINT=$?
if [ $RUBOCOP -eq $ESLINT ]; then
exit 0
else
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment