diff --git a/README.md b/README.md
index 5f1c27c4..f262b2bf 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,9 @@ This is the git repository for version 2+ of the PIC-SURE API.
## Pre-requisits
-* Java 11
+* Java 11
+* Before contributing code, please set up our git hook:
+ `cp code-formatting/pre-commit.sh .git/hooks/pre-commit`
## Build
The build consists of the following top level maven modules:
diff --git a/code-formatting/eclipse-formatter.xml b/code-formatting/eclipse-formatter.xml
new file mode 100644
index 00000000..e7cfabab
--- /dev/null
+++ b/code-formatting/eclipse-formatter.xml
@@ -0,0 +1,402 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code-formatting/pre-commit.sh b/code-formatting/pre-commit.sh
new file mode 100755
index 00000000..97d05d12
--- /dev/null
+++ b/code-formatting/pre-commit.sh
@@ -0,0 +1,28 @@
+#!/bin/sh -e
+CWD=$(pwd)
+cd $(git rev-parse --show-toplevel)
+format_cmd=""
+
+# skip if NO_VERIFY env var set
+if [ "$NO_VERIFY" ]; then
+ echo 'code formatting skipped' 1>&2
+ exit 0
+fi
+
+# I'm not great at bash, so this is a bit ugly, but I'll explain each pipe
+# 1. Get all staged files
+# 2. Reduce to just .java files
+# 3. Replace newlines with commas (this was really hard to do in sed)
+# 4. Replace commas with $,^.*
+# 5. Crop off the last 4 chars
+# This results in foo.java$,^.*bar.java$baz.java$
+# I then append ^.* to the beginning of that.
+FILES_TO_STAGE_AGAIN=$(git diff --staged --name-only --diff-filter=ACMR)
+STAGED_JAVA_FILES=$(git diff --staged --name-only --diff-filter=ACMR | grep '.java$' | tr '\n' ',' | sed -e 's/,/$,^.*/g' | sed 's/.\{4\}$//')
+if [ -n "$STAGED_JAVA_FILES" ]; then
+ echo "Found the following staged java files to format: $STAGED_JAVA_FILES"
+ mvn spotless:apply -DspotlessFiles=^.*$STAGED_JAVA_FILES
+ git add $FILES_TO_STAGE_AGAIN
+fi
+
+cd $CWD
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 48c0b29c..e907054e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,10 +24,38 @@
2.10.5
+ 2.41.1
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ ${spotless.version}
+
+
+
+
+ .gitattributes
+ .gitignore
+
+
+
+
+ true
+ 4
+
+
+
+
+
+ 4.26
+ code-formatting/eclipse-formatter.xml
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin