diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100755 index 0000000..9787c49 --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Run spotless checks on staged files only. +# This is faster than running spotless on all files. +./mvnw spotless:check -DspotlessFiles="$(git diff --staged --name-only | grep ".java$" | sed 's/^/.*/' | paste -sd ',' -)" + +declare errcode=$? +if [ $errcode -ne 0 ]; then + echo + echo "Run \`./mvnw spotless:apply\` to automatically fix these format violations." + exit $errcode +fi diff --git a/pom.xml b/pom.xml index 64dfa3e..5f622e8 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,7 @@ 3.13.0 3.6.3 3.2.5 + 3.5.0 0.8.12 4.8.5 4.8.5.0 @@ -175,6 +176,13 @@ ${spotless.version} + + + com.rudikershaw.gitbuildhook + git-build-hook-maven-plugin + ${git-build-hook-maven-plugin.version} + + ${quarkus.platform.group-id} quarkus-maven-plugin @@ -434,6 +442,26 @@ + + + com.rudikershaw.gitbuildhook + git-build-hook-maven-plugin + ${git-build-hook-maven-plugin.version} + + + + hooks/ + + + + + + + configure + + + +