#!/bin/sh rake spec valid=$? if [[ $valid -ne 0 ]]; then exit $valid fi for file in $(git diff-index --name-only --diff-filter AM --cached HEAD); do if (echo $file | egrep -q '(\.rb|Gemfile|Rakefile|\.gemspec)$') then bundle exec rubocop --force-exclusion $file valid=$(( $valid == 0 ? $? : $valid )) fi done exit $valid