-
Notifications
You must be signed in to change notification settings - Fork 3
/
pre-push.sh
executable file
·44 lines (35 loc) · 1023 Bytes
/
pre-push.sh
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
#!/bin/sh
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 SCSS Lint\033[0m"
# RUN_CHECK_CMD='bundle exec scss-lint app/assets/stylesheets/'
# RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}`
# if [ $? -eq 1 ]
# then
# echo "\033[34mCan't commit! You have scss lint offences!!!\033[0m"
# exit 1
# fi
echo "\033[34mRunning eslint\033[0m"
RUN_CHECK_CMD='yarn run lint'
RUN_TESTS_OUTPUT=`${RUN_CHECK_CMD}`
if [ $? -eq 1 ]
then
echo "\033[34mCan't commit! You have eslint problems!!!\033[0m"
exit 1
fi
echo "\033[34mRunning Rubocop\033[0m"
RUN_CHECK_CMD='bundle exec rubocop app spec -R --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[34mAll checks passed. You didn't break anything. Congrats!\n\033[0m"
exit 0