Skip to content

Instantly share code, notes, and snippets.

@dbarria
Last active November 14, 2018 16:25
Show Gist options
  • Save dbarria/58207589be1a30e582f27367f3e37749 to your computer and use it in GitHub Desktop.
Save dbarria/58207589be1a30e582f27367f3e37749 to your computer and use it in GitHub Desktop.
Precommit hook to run reek
#!/bin/bash -l
source "$HOME/.rvm/scripts/rvm"
cd $HOME/arboles/camperfarm-web
find . -type f -name "*.rb" ! -path './vendor/*' ! -path './spec/*' | sort > current_rb_files
diff_command=`diff --new-line-format="" --unchanged-line-format="" current_rb_files .reek_legacy_file_list`
rm current_rb_files
if [ -z "$diff_command" ]; then
echo "There is no ruby files to analyze"
else
echo $diff_command | tr "\r\n" " " | xargs bundle exec reek
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment