Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9532505

Browse files
Add pre-push spotless check to prevent pushes if spotlessApply has not been run (GetStream#964)
1 parent d765084 commit 9532505

File tree

5 files changed

+26
-50
lines changed

5 files changed

+26
-50
lines changed

‎build.gradle.kts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,12 @@ apply(from = "${rootDir}/scripts/publish-root.gradle")
5959
//fun teamPropsFile(propsFile: String): File {
6060
// val teamPropsDir = file("team-props")
6161
// return File(teamPropsDir, propsFile)
62-
//}
62+
//}
63+
64+
afterEvaluate {
65+
println("Running Add Pre Commit Git Hook Script on Build")
66+
exec {
67+
commandLine("cp", "./scripts/git-hooks/pre-push", "./.git/hooks")
68+
}
69+
println("Added pre-push Git Hook Script.")
70+
}

‎demo-app/src/main/kotlin/io/getstream/video/android/ui/login/LoginViewModel.kt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ sealed interface LoginUiState {
149149

150150
data class GoogleSignIn(val signInIntent: Intent) : LoginUiState
151151

152-
data class SignInComplete(val authData: GetAuthDataResponse) : LoginUiState
152+
data class SignInComplete(
153+
154+
val authData: GetAuthDataResponse,
155+
) : LoginUiState
153156

154157
data class SignInFailure(val errorMessage: String) : LoginUiState
155158
}

‎scripts/git-hooks/pre-push‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Run spotlessCheck before committing
4+
./gradlew spotlessCheck
5+
6+
# Get the exit code of the previous command
7+
RESULT=$?
8+
9+
# If spotlessCheck failed, prevent the commit
10+
if [ $RESULT -ne 0 ]; then
11+
echo "SpotlessCheck failed. Please fix the formatting issues before committing."
12+
exit 1
13+
fi

‎team-props/git-hooks.gradle.kts‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎team-props/git-hooks/pre-commit.sh‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)