@@ -38,7 +38,7 @@ while read local_ref local_sha remote_ref remote_sha; do
3838 # ============================================================================
3939 # CHECK 1: Scan commit messages for AI attribution
4040 # ============================================================================
41- echo " Checking commit messages for AI attribution..."
41+ printf " Checking commit messages for AI attribution...\n "
4242
4343 # Check each commit in the range for AI patterns.
4444 while IFS= read -r commit_sha; do
@@ -47,51 +47,51 @@ while read local_ref local_sha remote_ref remote_sha; do
4747 if echo " $full_msg " | grep -qiE " (Generated with|Co-Authored-By: Claude|Co-Authored-By: AI|🤖 Generated|AI generated|Claude Code|@anthropic|Assistant:|Generated by Claude|Machine generated)" ; then
4848 if [ $ERRORS -eq 0 ]; then
4949 printf " ${RED} ✗ BLOCKED: AI attribution found in commit messages!${NC} \n"
50- echo " Commits with AI attribution:"
50+ printf " Commits with AI attribution:\n "
5151 fi
5252 echo " - $( git log -1 --oneline " $commit_sha " ) "
5353 ERRORS=$(( ERRORS + 1 ))
5454 fi
5555 done < <( git rev-list " $range " )
5656
5757 if [ $ERRORS -gt 0 ]; then
58- echo " "
59- echo " These commits were likely created with --no-verify, bypassing the"
60- echo " commit-msg hook that strips AI attribution."
61- echo " "
62- echo " To fix:"
63- echo " git rebase -i $remote_sha "
64- echo " Mark commits as ' reword' , remove AI attribution, save"
65- echo " git push"
58+ printf " \n "
59+ printf " These commits were likely created with --no-verify, bypassing the\n "
60+ printf " commit-msg hook that strips AI attribution.\n "
61+ printf " \n "
62+ printf " To fix:\n "
63+ printf " git rebase -i %s\n " " $remote_sha "
64+ printf " Mark commits as . reword. , remove AI attribution, save\n "
65+ printf " git push\n "
6666 fi
6767
6868 # ============================================================================
6969 # CHECK 2: File content security checks
7070 # ============================================================================
71- echo " Checking files for security issues..."
71+ printf " Checking files for security issues...\n "
7272
7373 # Get all files changed in these commits.
74- CHANGED_FILES=$( git diff --name-only " $range " 2> /dev/null || echo " " )
74+ CHANGED_FILES=$( git diff --name-only " $range " 2> /dev/null || printf " \n " )
7575
7676 if [ -n " $CHANGED_FILES " ]; then
7777 # Check for sensitive files.
7878 if echo " $CHANGED_FILES " | grep -qE ' ^\.env(\.local)?$' ; then
7979 printf " ${RED} ✗ BLOCKED: Attempting to push .env file!${NC} \n"
80- echo " Files: $( echo " $CHANGED_FILES " | grep -E ' ^\.env(\.local)?$' ) "
80+ printf " Files: %s\n " " $( echo " $CHANGED_FILES " | grep -E ' ^\.env(\.local)?$' ) "
8181 ERRORS=$(( ERRORS + 1 ))
8282 fi
8383
8484 # Check for .DS_Store.
8585 if echo " $CHANGED_FILES " | grep -q ' \.DS_Store' ; then
8686 printf " ${RED} ✗ BLOCKED: .DS_Store file in push!${NC} \n"
87- echo " Files: $( echo " $CHANGED_FILES " | grep ' \.DS_Store' ) "
87+ printf " Files: %s\n " " $( echo " $CHANGED_FILES " | grep ' \.DS_Store' ) "
8888 ERRORS=$(( ERRORS + 1 ))
8989 fi
9090
9191 # Check for log files.
9292 if echo " $CHANGED_FILES " | grep -E ' \.log$' | grep -v ' test.*\.log' | grep -q . ; then
9393 printf " ${RED} ✗ BLOCKED: Log file in push!${NC} \n"
94- echo " Files: $( echo " $CHANGED_FILES " | grep -E ' \.log$' | grep -v ' test.*\.log' ) "
94+ printf " Files: %s\n " " $( echo " $CHANGED_FILES " | grep -E ' \.log$' | grep -v ' test.*\.log' ) "
9595 ERRORS=$(( ERRORS + 1 ))
9696 fi
9797
@@ -144,9 +144,9 @@ while read local_ref local_sha remote_ref remote_sha; do
144144done
145145
146146if [ $TOTAL_ERRORS -gt 0 ]; then
147- echo " "
147+ printf " \n "
148148 printf " ${RED} ✗ Push blocked by mandatory validation!${NC} \n"
149- echo " Fix the issues above before pushing."
149+ printf " Fix the issues above before pushing.\n "
150150 exit 1
151151fi
152152
0 commit comments