From 6d6d2ad2c151ffd3aa4d8a44e23d6f3bc44a1edb Mon Sep 17 00:00:00 2001 From: Nick Galluzzo Date: Wed, 6 Aug 2025 14:56:53 +0700 Subject: [PATCH 1/2] fix(evaluation): adjust score thresholds for quality ratings Update the score thresholds in QualityRater to ensure proper categorization of ratings. The previous implementation had overlapping or incorrect ranges that could lead to misclassification. This change ensures each rating category has a distinct and accurate score range. --- src/diffmage/evaluation/models.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/diffmage/evaluation/models.py b/src/diffmage/evaluation/models.py index eba2f4a..95af473 100644 --- a/src/diffmage/evaluation/models.py +++ b/src/diffmage/evaluation/models.py @@ -25,19 +25,19 @@ def get_quality_level(score: float) -> str: Returns one of: - Excellent (4.5-5.0) - Good (3.5-4.4) - - Average (2.6-3.5) - - Poor (1.6-2.5) - - Very Poor (0.0-1.5) + - Average (2.5-3.4) + - Poor (1.5-2.4) + - Very Poor (1.0-1.4) """ - if score >= ScoreThresholds.EXCELLENT: + if score >= ScoreThresholds.EXCELLENT: # 4.5-5.0 return "Excellent" - elif score > ScoreThresholds.GOOD: + elif score >= ScoreThresholds.GOOD: # 3.5-4.4 return "Good" - elif score > ScoreThresholds.AVERAGE: + elif score >= ScoreThresholds.AVERAGE: # 2.5-3.4 return "Average" - elif score > ScoreThresholds.POOR: + elif score >= ScoreThresholds.POOR: # 1.5-2.4 return "Poor" - else: + else: # 1.0-1.4 return "Very Poor" @staticmethod From cce098b7e3fee4aff8463c9bd63f2e16d067c83e Mon Sep 17 00:00:00 2001 From: Nick Galluzzo Date: Wed, 6 Aug 2025 15:00:22 +0700 Subject: [PATCH 2/2] fix(tests): correct quality distribution assertions in evaluation report tests --- tests/evaluation/test_evaluation_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/evaluation/test_evaluation_report.py b/tests/evaluation/test_evaluation_report.py index 3754d0f..33f3c6d 100644 --- a/tests/evaluation/test_evaluation_report.py +++ b/tests/evaluation/test_evaluation_report.py @@ -381,8 +381,8 @@ def test_quality_distribution_calculations(self, report): assert stats["quality_distribution"]["Excellent"] == 0 assert stats["quality_distribution"]["Good"] == 1 - assert stats["quality_distribution"]["Average"] == 0 - assert stats["quality_distribution"]["Poor"] == 1 + assert stats["quality_distribution"]["Average"] == 1 + assert stats["quality_distribution"]["Poor"] == 0 def test_model_usage_calculations(self, report): """Test model usage calculations"""