mirror of
https://github.com/ludo-technologies/pyscn.git
synced 2025-10-06 00:59:45 +03:00
**Problem:** CBO analysis was only counting High Risk classes (CBO > 7) for penalty calculation, completely ignoring Medium Risk classes (3 < CBO ≤ 7). Example: Project with 364 classes, multiple classes at CBO=6, but score = 100/100 because all were "Medium Risk" (not counted). **Solution:** 1. Added `MediumCouplingClasses` field to track Medium Risk classes 2. Updated penalty calculation to use weighted ratio: - High Risk classes: weight = 1.0 - Medium Risk classes: weight = 0.5 Formula: (HighRisk × 1.0 + MediumRisk × 0.5) / TotalClasses **Impact:** Projects with many Medium Risk classes will now receive appropriate penalties: - 10% weighted ratio → -6 points (Low penalty) - 30% weighted ratio → -12 points (Medium penalty) - 60% weighted ratio → -20 points (High penalty) This makes CBO scoring more realistic and catches coupling issues that were previously ignored. **Files Changed:** - domain/analyze.go: Added MediumCouplingClasses field, updated penalty logic - app/analyze_usecase.go: Set MediumCouplingClasses from CBO analysis - domain/analyze.go: Added validation for new field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>