File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,14 @@ allprojects {
64
64
}
65
65
}
66
66
67
+ task installGitHook (type : Copy ) {
68
+ from new File (rootProject. rootDir, ' pre-commit' )
69
+ into { new File (rootProject. rootDir, ' .git/hooks' ) }
70
+ fileMode 0777
71
+ }
72
+
67
73
task clean (type : Delete ) {
74
+ dependsOn(installGitHook)
68
75
delete rootProject. buildDir
69
76
}
70
77
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ echo " Running pre-commit checks..."
3
+
4
+ OUTPUT=" /tmp/analysis-result"
5
+ ./gradlew detekt ktlintCheck > ${OUTPUT}
6
+ EXIT_CODE=$?
7
+ if [ ${EXIT_CODE} -ne 0 ]; then
8
+ cat ${OUTPUT}
9
+ rm ${OUTPUT}
10
+ echo " *********************************************"
11
+ echo " Checks Failed! "
12
+ echo " Resolve found issues before committing "
13
+ echo " *********************************************"
14
+ exit ${EXIT_CODE}
15
+ else
16
+ rm ${OUTPUT}
17
+ echo " *********************************************"
18
+ echo " Checks Passed Successfully! "
19
+ echo " *********************************************"
20
+ fi
You can’t perform that action at this time.
0 commit comments