Skip to content

Commit ebe46bd

Browse files
committed
docs: add critical warning against using --no-verify
1 parent 1ef97b6 commit ebe46bd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env sh
22

33
# Get list of staged PHP files
4-
STAGED_PHP_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.php$')
4+
STAGED_PHP_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.php$' || true)
55

66
if [ -n "$STAGED_PHP_FILES" ]; then
77
echo "Running PHPStan on staged PHP files..."

CLAUDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,10 @@ composer phpcbf -- src/Gateways/PaymentMethods/WCGatewayMoneiCC.php
378378

379379
Automatically runs PHPStan on staged PHP files before each commit. This prevents committing code with type errors.
380380

381-
**To bypass** (not recommended):
382-
```bash
383-
git commit --no-verify -m "message"
384-
```
381+
**CRITICAL**: NEVER use `--no-verify` to bypass pre-commit hooks!
382+
- Pre-commit hooks are there to catch errors before they reach the repository
383+
- If the hook fails, fix the actual errors instead of bypassing the check
384+
- Using `--no-verify` can introduce bugs and break the build
385385

386386
### Common PHPStan Errors & Fixes
387387

0 commit comments

Comments
 (0)