-
Notifications
You must be signed in to change notification settings - Fork 1
/
pre-push
57 lines (45 loc) · 1.33 KB
/
pre-push
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# Move this file to .git/hooks
# Remember to execute chmod +x
echo "\033[34mRunning Rspec tests\033[0m"
RUN_CHECK_CMD='bundle exec rspec spec -fd'
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}`
if [ $? -eq 1 ]
then
echo "\033[34mCan't commit! You've broken Rspec tests!!!\033[0m"
exit 1
fi
echo "\033[34mRunning Rubocop\033[0m"
RUN_CHECK_CMD='bundle exec rubocop app spec --format simple'
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}`
if [ $? -eq 1 ]
then
echo "\033[34mCan't commit! You have Rubocop offences!!!\033[0m"
exit 1
fi
echo "\033[34mRunning Brakeman\033[0m"
RUN_CHECK_CMD='bundle exec brakeman -q --no-summary'
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}`
if [ $? -eq 1 ]
then
echo "\033[34mCan't commit! You have Brakeman offences!!!\033[0m"
exit 1
fi
echo "\033[34mRunning bundler-audit\033[0m"
RUN_CHECK_CMD='bundle exec bundle audit check --update --quiet'
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}`
if [ $? -eq 1 ]
then
echo "\033[34mCan't commit! You have bundler-audit offences!!!\033[0m"
exit 1
fi
echo "\033[34mRunning RubyCritic\033[0m"
RUN_CHECK_CMD='bundle exec rubycritic --minimum-score 80 --no-browser'
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}`
if [ $? -eq 1 ]
then
echo "\033[34mCan't commit! You have RubyCritic offences!!!\033[0m"
exit 1
fi
echo "\033[34mAll checks passed. You didn't break anything. Congrats!\n\033[0m"
exit 0