feat: use calibrated per-rule scores in final percentage calculation#110
feat: use calibrated per-rule scores in final percentage calculation#110
Conversation
Replace flat severity weights (blocking=3.0, risk=2.0, etc.) with calculatedScore from rule engine in density calculation. This makes per-rule scores and depthWeight from rule-config.ts actually influence the user-facing score, connecting the calibration pipeline to output. Before: no-auto-layout (-10) and missing-size-constraint (-3) both contributed 3.0 (same severity = same weight). depthWeight was computed but never consumed by scoring. After: no-auto-layout at root contributes 15 (|-10 × 1.5|), while missing-size-constraint contributes 3 (|-3 × 1.0|). Calibration loop score adjustments now flow through to final percentages. Closes #104
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes replace severity-based density weighting with per-issue Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Before/After Score ComparisonRan analysis on 4 fixtures comparing old (flat severity weights) vs new (calculatedScore): Overall
By Category (selected highlights)
Full category breakdownObservations
|
Summary
calculatedScorefrom rule engine in density calculationdepthWeightfromrule-config.tsnow actually influence user-facing scoresWhat was wrong
calculateScores()usedSEVERITY_DENSITY_WEIGHT(blocking=3.0, risk=2.0, missing-info=1.0, suggestion=0.5) for density. This meant:no-auto-layout(score: -10) andmissing-size-constraint(score: -3) were treated the samedepthWeightwas computed intocalculatedScorebut never consumed by scoringrule-config.tsvia calibration loop had zero effect on user-facing scoresWhat this fixes
Now
calculateScores()usesMath.abs(issue.calculatedScore)instead of flat severity weights:no-auto-layoutat root (score -10, depthWeight 1.5)no-auto-layoutat leaf (score -10, depthWeight 1.0)missing-size-constraint(score -3)unnecessary-node(score -2)Test plan
Closes #104
Made with Cursor
Summary by CodeRabbit