... | ... | @@ -32,3 +32,21 @@ import androidx.compose.runtime.getValue |
|
|
import androidx.compose.runtime.setValue
|
|
|
```
|
|
|
|
|
|
## Git hooks
|
|
|
|
|
|
If you want to avoid committing or pushing code that doesn't comply with the coding conventions,
|
|
|
it can help to add a git hook.
|
|
|
|
|
|
For example to create a hook that prevents you from pushing commits that fail `./gradle ktlintCheck`, add the following script at `.git/hooks/pre-push`:
|
|
|
|
|
|
```
|
|
|
#/bin/bash
|
|
|
|
|
|
./gradlew ktlintCheck
|
|
|
if [ $? -ne 0 ]; then
|
|
|
echo "ktlint failed"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
exit 0
|
|
|
``` |
|
|
\ No newline at end of file |