This commit is contained in:
23
examples/pre-commit-hook.sh
Normal file
23
examples/pre-commit-hook.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Pre-commit hook for Code Privacy Shield
|
||||||
|
# Add this to .git/hooks/pre-commit
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Find the project root
|
||||||
|
ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
# Check if CPS is available
|
||||||
|
if command -v cps &> /dev/null; then
|
||||||
|
echo "Running Code Privacy Shield check..."
|
||||||
|
|
||||||
|
# Check staged Python files
|
||||||
|
FILES=$(git diff --cached --name-only -- '*.py' '*.js' '*.ts' '*.json' '*.yaml' '*.yml' 2>/dev/null || true)
|
||||||
|
|
||||||
|
if [ -n "$FILES" ]; then
|
||||||
|
# Preview what would be redacted
|
||||||
|
echo "$FILES" | xargs -I {} sh -c 'echo "Checking {}"; cps preview "{}" 2>/dev/null || true'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user