-
-
Notifications
You must be signed in to change notification settings - Fork 391
Expand file tree
/
Copy pathpre-commit.sh
More file actions
executable file
·23 lines (21 loc) · 734 Bytes
/
pre-commit.sh
File metadata and controls
executable file
·23 lines (21 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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 "*********************************************"
exit ${EXIT_CODE}
else
rm ${OUTPUT}
echo "*********************************************"
echo " Static analysis no problems found "
echo "*********************************************"
fi