Olufemi Adeojo
05/13/2025, 10:00 PMtrevjones
05/13/2025, 10:08 PMJanzzen Matthew De Jesus
05/14/2025, 6:10 AMScott Fedorov
05/14/2025, 11:40 AMScott Fedorov
05/14/2025, 11:40 AMEdgar Avuzi
05/14/2025, 1:55 PM./mvnw ktlint:format
as a pre-commit hook
• robot for creating PRs/ MRs with ./mvnw ktlint:format
autoformatted full codebase. For working in team
The plugin setup is in pom.xml in my pet project https://github.com/Sedose/codecrafters-interpreter-kotlin as an example. I'm sure there is one for Gradle as wellEdgar Avuzi
05/14/2025, 2:15 PMmkdir -p .githooks
• Run git config core.hooksPath .githooks
• Create similar file your_project_root/.githooks/pre-commit
#!/bin/bash
# Run ktlint:format before commit
echo "Running ktlint formatter..."
./mvnw ktlint:format
# Check for any unstaged changes (i.e., formatting changes)
if ! git diff --quiet
then
echo "Ktlint made formatting changes. Please review and stage them."
git diff
exit 1
fi
• Run chmod +x .githooks/pre-commit
With this setup you get autoformatting each time before you commit.
And add this file to git to track it for your team so that everyone can use itEdgar Vonk
05/15/2025, 8:13 AMDetekt
for all Kotlin code in our project and Spotless
for all other code. If you are interested you can check our Gradle build file: https://github.com/infonl/dimpact-zaakafhandelcomponent/blob/main/build.gradle.ktsAnonymike
05/20/2025, 5:22 PMEdgar Avuzi
05/20/2025, 5:36 PMJonathan Hult
05/20/2025, 5:39 PMAnonymike
05/20/2025, 5:40 PMtrevjones
05/20/2025, 5:48 PMAnonymike
05/20/2025, 6:49 PMAnonymike
05/20/2025, 6:49 PMtrevjones
05/20/2025, 6:52 PM