-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add pre-commit file for auto formatting
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# 스테이징된 Python 파일들만 가져오기 | ||
files=$(git diff --cached --name-only --diff-filter=d | grep '\.py$') | ||
|
||
if [ -z "$files" ]; then | ||
echo "No Python files to check" | ||
exit 0 | ||
fi | ||
|
||
echo "Starting code checks..." | ||
|
||
# 각 명령어의 실행 결과를 체크 | ||
if ! poetry run isort $files; then | ||
echo "isort failed" | ||
exit 1 | ||
fi | ||
|
||
if ! poetry run black $files; then | ||
echo "black failed" | ||
exit 1 | ||
fi | ||
|
||
# 수정된 파일들 다시 스테이징 | ||
git add $files | ||
echo "Code checks completed successfully" | ||
|
||
exit 0 |