UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

43 lines (37 loc) 1.41 kB
# Proposed SRP Analyzer Improvements ## Option 1: Graduated Scoring Instead of harsh penalties for 2+ functions, scale gradually: - 1 function: 0 points (perfect) - 2-3 functions: +1 point (minor) - 4-6 functions: +3 points (moderate) - 7-10 functions: +5 points (high) - 10+ functions: +8 points (critical) ## Option 2: Context-Aware Thresholds Different file types get different rules: - Test files: Allow up to 10 test functions - Utility files: Allow 3-5 related helpers - Config files: More lenient - Core business logic: Stricter ## Option 3: Complexity Weighting Consider function size/complexity: - Count lines per function - Functions <5 lines count as 0.5 - Functions >50 lines count as 2.0 - Score based on weighted total ## Option 4: Relationship Detection Try to detect related functions: - Functions with similar names (openDB, closeDB) - Functions that call each other - Functions in same lexical scope - Group penalty only if unrelated ## Option 5: Practical Defaults Change the definition: - "Strict mode": Current behavior (1 function = compliant) - "Standard mode": Up to 3 related functions OK - "Lenient mode": Focus on files with 5+ functions ## Recommendation Implement Option 1 (Graduated Scoring) + Option 2 (Context-Aware) as they: - Are easiest to implement with static analysis - Provide more reasonable results - Still encourage good practices - Don't require complex heuristics