forked from trent_larson/crowd-funder-for-time-pwa
feat(git): implement debug code prevention system with deliberate installation
Implements comprehensive pre-commit hook system to prevent debug code from reaching protected branches while maintaining developer choice. - Hooks stored in scripts/git-hooks/ (not in .git tree) - Deliberate installation required - no forced behavior - Automated installation script for team members - Comprehensive testing - Branch-aware execution (protected vs feature branches) - Configurable patterns and protected branch list Philosophy: Each developer chooses whether to use the hook, ensuring team flexibility while providing powerful debug code prevention tools.
This commit is contained in:
70
scripts/git-hooks/debug-checker.config
Normal file
70
scripts/git-hooks/debug-checker.config
Normal file
@@ -0,0 +1,70 @@
|
||||
# TimeSafari Debug Checker Configuration
|
||||
# Edit this file to customize protected branches and debug patterns
|
||||
|
||||
# Protected branches where debug code checking is enforced
|
||||
# Add or remove branches as needed
|
||||
PROTECTED_BRANCHES=(
|
||||
"master"
|
||||
"main"
|
||||
"production"
|
||||
"release"
|
||||
"stable"
|
||||
)
|
||||
|
||||
# Debug patterns to detect (regex patterns)
|
||||
# Add or remove patterns as needed
|
||||
DEBUG_PATTERNS=(
|
||||
# Console statements
|
||||
"console\."
|
||||
|
||||
# Template debug text
|
||||
"Debug:"
|
||||
"debug:"
|
||||
|
||||
# Debug constants and variables
|
||||
"DEBUG_"
|
||||
"debug_"
|
||||
|
||||
# HTML debug comments
|
||||
"<!-- debug"
|
||||
|
||||
# Debug attributes
|
||||
"debug.*="
|
||||
|
||||
# Vue debug patterns
|
||||
"v-if.*debug"
|
||||
"v-show.*debug"
|
||||
|
||||
# Common debug text
|
||||
"TODO.*debug"
|
||||
"FIXME.*debug"
|
||||
|
||||
# Debug imports (uncomment if you want to catch these)
|
||||
# "import.*debug"
|
||||
# "require.*debug"
|
||||
)
|
||||
|
||||
# Files and directories to skip during checking
|
||||
# Add patterns to exclude from debug checking
|
||||
SKIP_PATTERNS=(
|
||||
"\.(test|spec)\.(js|ts|vue)$" # Test files (must have .test. or .spec.)
|
||||
"^scripts/" # Scripts directory
|
||||
"^test-.*/" # Test directories (must end with /)
|
||||
"^\.git/" # Git directory
|
||||
"^node_modules/" # Dependencies
|
||||
"^docs/" # Documentation
|
||||
"^\.cursor/" # Cursor IDE files
|
||||
"\.md$" # Markdown files
|
||||
"\.txt$" # Text files
|
||||
"\.json$" # JSON config files
|
||||
"\.yml$" # YAML config files
|
||||
"\.yaml$" # YAML config files
|
||||
)
|
||||
|
||||
# Logging level (debug, info, warn, error)
|
||||
LOG_LEVEL="info"
|
||||
|
||||
# Exit codes
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_DEBUG_FOUND=1
|
||||
EXIT_ERROR=2
|
||||
Reference in New Issue
Block a user