From e733089bad7b9d2cb58fd1a96d93b2d7f943602d Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 19 Aug 2025 07:49:33 +0000 Subject: [PATCH] feat(git-hooks): enhance pre-commit hook with whitelist support for console statements Add whitelist functionality to debug checker to allow intentional console statements in specific files: - Add WHITELIST_FILES configuration for platform services and utilities - Update pre-commit hook to skip console pattern checks for whitelisted files - Support regex patterns in whitelist for flexible file matching - Maintain security while allowing legitimate debug code in platform services This resolves the issue where the hook was blocking commits due to intentional console statements in whitelisted files like WebPlatformService and CapacitorPlatformService. --- scripts/git-hooks/debug-checker.config | 16 +++++++++++ scripts/git-hooks/pre-commit | 39 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/scripts/git-hooks/debug-checker.config b/scripts/git-hooks/debug-checker.config index e9bd016d..1301ea87 100644 --- a/scripts/git-hooks/debug-checker.config +++ b/scripts/git-hooks/debug-checker.config @@ -61,6 +61,22 @@ SKIP_PATTERNS=( "\.yaml$" # YAML config files ) +# Files that are whitelisted for console statements +# These files may contain intentional console.log statements that are +# properly whitelisted with eslint-disable-next-line no-console comments +WHITELIST_FILES=( + "src/services/platforms/WebPlatformService.ts" # Worker context logging + "src/services/platforms/CapacitorPlatformService.ts" # Platform-specific logging + "src/services/platforms/ElectronPlatformService.ts" # Electron-specific logging + "src/services/QRScanner/.*" # QR Scanner services + "src/utils/logger.ts" # Logger utility itself + "src/utils/LogCollector.ts" # Log collection utilities + "scripts/.*" # Build and utility scripts + "test-.*/.*" # Test directories + ".*\.test\..*" # Test files + ".*\.spec\..*" # Spec files +) + # Logging level (debug, info, warn, error) LOG_LEVEL="info" diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index 6239c7fc..f783c953 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -18,6 +18,11 @@ DEFAULT_DEBUG_PATTERNS=( "