Skip to content

Commit 98f181b

Browse files
committed
Nice output, eh?
1 parent 59753a7 commit 98f181b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pre-commit

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#
1414
##########
1515

16+
GRAY='\033[0;37m'
17+
RED='\033[0;31m'
18+
GREEN='\033[0;32m'
19+
1620
PHPCS_BIN=/usr/bin/phpcs
1721
PHPMD_BIN=/usr/bin/phpmd
1822
PHPCS_CODING_STANDARD=PEAR
@@ -114,36 +118,36 @@ do
114118
done
115119

116120
echo ""
117-
echo " :: PHP CodeSniffer inspection :: "
121+
tput setaf 7; echo " :: PHP CodeSniffer inspection :: "
118122
PHPCS_OUTPUT=$($PHPCS_BIN -s $IGNORE_WARNINGS --standard=$PHPCS_CODING_STANDARD $ENCODING $IGNORE $STAGED_FILES)
119123
PHPCS_RETVAL=$?
120124

121125
if [ $PHPCS_RETVAL -ne 0 ]; then
122-
echo " Issues found: "
126+
tput setaf 1; echo " -> Issues found: "
127+
tput setaf 7;
123128
echo "$PHPCS_OUTPUT"
124129

125130
rm -rf $TMP_STAGING
126131

127132
exit $PHPCS_RETVAL
128133
else
129-
echo " -> Inspection is OK!"
134+
tput setaf 2; echo " -> Inspection is OK!"
130135
fi
131136

132137
echo ""
133-
echo " :: PHP Mess Detector inspection :: "
134-
echo ""
138+
tput setaf 7; echo " :: PHP Mess Detector inspection :: "
135139
PHPMD_OUTPUT=$($PHPMD_BIN $STAGED_FILES $PHPMD_OUTPUT_MODE $PHPMD_PATTERNS)
136140
PHPMD_RETVAL=$?
137141

138142
if [ $PHPMD_RETVAL -ne 0 ]; then
139-
echo " Issues found: "
140-
echo "$PHPMD_OUTPUT"
143+
tput setaf 1; echo " -> Issues found: "
144+
tput setaf 7; echo "$PHPMD_OUTPUT"
141145

142146
rm -rf $TMP_STAGING
143147

144148
exit $PHPMD_RETVAL
145149
else
146-
echo " -> Inspection is OK!"
150+
tput setaf 2; echo " -> Inspection is OK!"
147151
fi
148152

149153
exit 0;

0 commit comments

Comments
 (0)