#!/bin/zsh source ~/.zshrc grep 'rack-mini-profiler' Gemfile.lock >> /dev/null if [ $? -eq 0 ]; then echo 'rack-mini-profiler detected in Gemfile.lock.' echo 'Please remove rack-mini-profiler from your Gemfile(.local), run bundle and commit again, commit aborted' exit 1 fi grep --exclude-dir={"lib/renuo_bin_check/default_scripts","spec/renuo/bin-check/default_scripts"} -i -r 'TODO' lib spec Gemfile if [ $? -eq 0 ]; then echo 'TODOs found. Please fix them and try again, commit aborted' exit 1 fi grep --exclude-dir={"lib/renuo_bin_check/default_scripts","spec/renuo/bin-check/default_scripts"} -i -r 'console.log' lib spec if [ $? -eq 0 ]; then echo 'console.log found. Please fix them and try again, commit aborted' exit 1 fi grep --exclude-dir={"lib/renuo_bin_check/default_scripts","spec/renuo/bin-check/default_scripts"} -i -r ' puts ' lib spec if [ $? -eq 0 ]; then echo 'puts found. Please fix them and try again, commit aborted' exit 1 fi grep --exclude-dir={"lib/renuo_bin_check/default_scripts","spec/renuo/bin-check/default_scripts"} -i -r ' puts(' lib spec if [ $? -eq 0 ]; then echo 'puts found. Please fix them and try again, commit aborted' exit 1 fi grep --exclude-dir={"lib/renuo_bin_check/default_scripts","spec/renuo/bin-check/default_scripts"} -i -r ' p ' lib spec if [ $? -eq 0 ]; then echo 'p found. Please fix them and try again, commit aborted' exit 1 fi grep --exclude-dir={"lib/renuo_bin_check/default_scripts","spec/renuo/bin-check/default_scripts"} -i -r ' p(' lib spec if [ $? -eq 0 ]; then echo 'p found. Please fix them and try again, commit aborted' exit 1 fi bundle exec rubocop -D -c .rubocop.yml --fail-fast if [ ! $? -eq 0 ]; then echo 'rubocop detected issues!' bundle exec rubocop -a -D -c .rubocop.yml echo 'Tried to auto correct the issues, but must be reviewed manually, commit aborted' exit 1 fi bundle exec reek if [ ! $? -eq 0 ]; then echo 'reek detected code smells, commit aborted' exit 1 fi bundle exec rspec if [ ! $? -eq 0 ]; then echo 'rspec did not run successfully, commit aborted' exit 1 fi