88
99import subprocess
1010import sys
11- import os
1211from pathlib import Path
1312
1413
@@ -93,6 +92,13 @@ def install_hooks():
9392 if not success :
9493 return False
9594
95+ # Verify hooks are installed
96+ if Path (".git/hooks/pre-commit" ).exists ():
97+ print ("✅ Pre-commit hook installed in .git/hooks/pre-commit" )
98+ else :
99+ print ("❌ Pre-commit hook not found in .git/hooks/" )
100+ return False
101+
96102 # Install commit message hooks (optional)
97103 success , _ = run_command (
98104 "pre-commit install --hook-type commit-msg" ,
@@ -159,10 +165,11 @@ def show_usage_info():
159165 print (
160166 """
161167🎯 How Pre-commit Hooks Work:
162- • Hooks run automatically before each git commit
163- • They check and auto-fix code quality issues
164- • Commits are blocked if critical issues are found
168+ • Hooks run AUTOMATICALLY on every ' git commit' command
169+ • NO manual intervention required - they execute automatically
170+ • Quality gate enforcement: commits are BLOCKED if checks fail
165171 • Auto-fixable issues (formatting) are corrected automatically
172+ • Developers must fix remaining issues before commit proceeds
166173
167174🛠️ Available Hooks:
168175 • Black: Auto-formats Python code (88 char line length)
@@ -179,11 +186,14 @@ def show_usage_info():
179186 • scripts/ - Utility scripts
180187 • src/ - Rust source code (for Rust hooks)
181188
182- 🚀 Common Commands:
183- • git commit -m "message" # Runs hooks automatically
184- • pre-commit run --all-files # Run hooks on all files
185- • pre-commit run <hook-id> # Run specific hook
186- • pre-commit skip # Skip hooks for one commit (not recommended)
189+ 🚀 Automatic Execution:
190+ • git commit -m "message" # Hooks run AUTOMATICALLY (no manual action needed)
191+ • git commit --no-verify # Skip hooks (emergency only, not recommended)
192+
193+ 🔧 Manual Testing (Optional):
194+ • pre-commit run --all-files # Test hooks on all files manually
195+ • pre-commit run <hook-id> # Test specific hook manually
196+ • pre-commit run --files <file> # Test hooks on specific files
187197
188198⚙️ Configuration Files:
189199 • .pre-commit-config.yaml - Hook configuration
0 commit comments