Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pre-commit 시 spotlessApply 실행 #412

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ spotless {

// pre-commit spotless check script
tasks.register('updateGitHooks', Copy) {
from './scripts/pre-commit'
into './.git/hooks'
from 'scripts/pre-commit'
into '.git/hooks'
}
compileJava.dependsOn updateGitHooks
23 changes: 13 additions & 10 deletions scripts/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
echo "Running spotless check"
./gradlew spotlessCheck
if [ \$? -eq 0 ]
then
echo "Spotless check succeed"
else
echo "Spotless check failed" >&2
exit 1
fi
#!/bin/sh

targetFiles=$(git diff --staged --name-only)

echo "Apply Spotless.."
./gradlew spotlessApply

# Add files to stage spotless applied
for file in $targetFiles; do
if test -f "$file"; then
git add $file
fi
done
Loading