forked from adessoTurkey/android-sample-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit.sh
More file actions
executable file
·25 lines (23 loc) · 866 Bytes
/
pre-commit.sh
File metadata and controls
executable file
·25 lines (23 loc) · 866 Bytes
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
#!/bin/sh
echo "Running static analysis..."
JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export JAVA_HOME
OUTPUT="/tmp/analysis-result"
./gradlew detekt ktlint lintDevDebug spotlessCheck --daemon > ${OUTPUT}
EXIT_CODE=$?
if [ ${EXIT_CODE} -ne 0 ]; then
cat ${OUTPUT}
rm ${OUTPUT}
echo "***********************************************"
echo " Static Analysis Failed "
echo " Please fix the above issues before committing "
echo " Hint: use './gradlew reformat' "
echo "If you really really need this, use --no-verify"
echo "***********************************************"
exit ${EXIT_CODE}
else
rm ${OUTPUT}
echo "***********************************************"
echo " Static analysis no problems found "
echo "***********************************************"
fi