Skip to content

Commit

Permalink
Make pre-commit hook behave more precisely (#95)
Browse files Browse the repository at this point in the history
* Modify pre-commit to add format changes more appropriately

* Test pre-commit hook change

* Test hook

* Revert "Test hook"

This reverts commit 6a4b041.

* Clarified documentation in pre-commit hook
  • Loading branch information
pordonj authored Apr 21, 2024
1 parent 5ff80c3 commit 15e1467
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

echo "**Performing pre-commit actions**"

echo "**Formatting code with spotless**"
echo "- Formatting code with spotless"
# This will format ALL FILES, even unstaged, but that's fine - everything should be formatted when eventually pushed.
./gradlew spotlessApply

echo "**Adding changes from reformat**"
# Add changes for any files already added to the repo - will not support partial repo commits currently
git add -u
echo "- Adding any changes from reformat"
# Add formatting changes to the commit for any files already staged (added)
git update-index --again

status=$?

Expand Down

0 comments on commit 15e1467

Please sign in to comment.