This project has some Git hooks included inside the git-hooks folder. These hooks can be installed automatically via the Gradle commands ./gradlew copyGitHooks
and ./gradlew installGitHooks
. You can find these commands in this Gradle file, but it's also good to know that the hooks are installed automatically just by running a clean
task. Thanks to Sebastiano's blog post for that inspiration.
There is a pre-commit hook that will automatically run Ktlint formatting over any modified Kotlin files. This way you can just commit your code and trust that formatting happens behind the scenes, without having to consciously worry about it.
There is a pre-push hook that will run static analysis checks before any code is pushed up to the remote repository. This way, if you have any code smells, you can be alerted right away without waiting for the GitHub Actions to fail.