diff --git a/PROJECT_GUIDELINES.md b/PROJECT_GUIDELINES.md index 20acbae..2fd3828 100644 --- a/PROJECT_GUIDELINES.md +++ b/PROJECT_GUIDELINES.md @@ -15,8 +15,10 @@ - ❌ **NEVER modify backend/API for frontend features without user confirmation** - ❌ **NEVER use custom CSS** - TailwindCSS classes only - ❌ **NEVER use JavaScript** - convert all to TypeScript -- ❌ **NEVER use object-oriented programming** patterns - use functional/other paradigms -- ❌ **NEVER add new Dockerfiles without user confirmation** +- ❌ **NEVER use object-oriented programming patterns in TypeScript** - avoid classes, inheritance, and OOP bloat; use functional/other paradigms +- ❌ **NEVER add new Dockerfiles without user confirmation + +**Note:** Go methods in the backend are fine and encouraged. This guideline applies to TypeScript/JavaScript frontend code only.** ### General - ❌ **NEVER skip pre-commit hooks** unless explicitly requested diff --git a/scripts/verify-quick.sh b/scripts/verify-quick.sh index d641493..26096a1 100755 --- a/scripts/verify-quick.sh +++ b/scripts/verify-quick.sh @@ -78,25 +78,21 @@ else success_msg "No JavaScript source files (TypeScript used, web/static/ excluded as compiled output)" fi -# GUIDELINE: NEVER use object-oriented programming patterns - use functional/other paradigms -# Hard to check automatically, but we can check for excessive struct methods -echo "Checking for potential OOP patterns (many methods per struct)..." -OOP_WARNINGS=$(find internal/ -name "*.go" -exec awk ' -/type [A-Z].*struct {/ { - in_struct=1 - next -} -in_struct && /func \(.*\)/ { - methods++ -} -END { - if (methods > 10) print FILENAME -} -' {} \; 2>/dev/null | wc -l) -if [ "$OOP_WARNINGS" -gt 5 ]; then - warning_msg "Found $OOP_WARNING_WARNS files with >10 methods (potential OOP pattern violation)" +# GUIDELINE: NEVER use OOP patterns in TypeScript - avoid classes, inheritance, OOP bloat +# Note: Go methods are fine and encouraged +echo "Checking for TypeScript OOP patterns..." +TS_OOP=$(find web/ -name "*.ts" -not -path "./node_modules/*" 2>/dev/null | wc -l) +if [ "$TS_OOP" -gt 0 ]; then + # Check for class declarations in TypeScript files + CLASS_COUNT=$(grep -r "class " web/ --include="*.ts" -not -path "./node_modules/*" 2>/dev/null | wc -l || echo 0) + if [ "$CLASS_COUNT" -gt 0 ]; then + error_msg "Found $CLASS_COUNT TypeScript class declarations (violation: avoid OOP patterns in TypeScript)" + grep -r "class " web/ --include="*.ts" -not -path "./node_modules/*" 2>/dev/null | head -5 + else + success_msg "No TypeScript OOP patterns found (functional/other paradigms used)" + fi else - success_msg "Struct methods within reasonable range (functional patterns likely)" + success_msg "No TypeScript files to check (or not using OOP)" fi ###############################################################################