Loading build.gradle +16 −0 Original line number Diff line number Diff line Loading @@ -46,3 +46,19 @@ tasks.register('clean', Delete) { delete rootProject.buildDir } tasks.register('installGitHooks', Copy) { description = 'Installs git hooks from scripts/hooks into .git/hooks' group = 'setup' from("${rootProject.rootDir}/scripts/hooks") into("${rootProject.rootDir}/.git/hooks") fileMode = 0755 } gradle.projectsEvaluated { subprojects { tasks.matching { it.name == 'preBuild' }.configureEach { dependsOn rootProject.tasks.named('installGitHooks') } } } scripts/hooks/pre-push 0 → 100644 +21 −0 Original line number Diff line number Diff line #!/usr/bin/env bash echo "🔍 Running Detekt..." ./gradlew detekt DETEKT_EXIT=$? if [ $DETEKT_EXIT -ne 0 ]; then echo "❌ Push rejected: fix Detekt issues before pushing." exit 1 fi echo "🔍 Running Lint..." ./gradlew lintRelease LINT_EXIT=$? if [ $LINT_EXIT -ne 0 ]; then echo "❌ Push rejected: fix Lint issues before pushing." exit 1 fi echo "✅ All checks passed!" exit 0 Loading
build.gradle +16 −0 Original line number Diff line number Diff line Loading @@ -46,3 +46,19 @@ tasks.register('clean', Delete) { delete rootProject.buildDir } tasks.register('installGitHooks', Copy) { description = 'Installs git hooks from scripts/hooks into .git/hooks' group = 'setup' from("${rootProject.rootDir}/scripts/hooks") into("${rootProject.rootDir}/.git/hooks") fileMode = 0755 } gradle.projectsEvaluated { subprojects { tasks.matching { it.name == 'preBuild' }.configureEach { dependsOn rootProject.tasks.named('installGitHooks') } } }
scripts/hooks/pre-push 0 → 100644 +21 −0 Original line number Diff line number Diff line #!/usr/bin/env bash echo "🔍 Running Detekt..." ./gradlew detekt DETEKT_EXIT=$? if [ $DETEKT_EXIT -ne 0 ]; then echo "❌ Push rejected: fix Detekt issues before pushing." exit 1 fi echo "🔍 Running Lint..." ./gradlew lintRelease LINT_EXIT=$? if [ $LINT_EXIT -ne 0 ]; then echo "❌ Push rejected: fix Lint issues before pushing." exit 1 fi echo "✅ All checks passed!" exit 0