Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit de4aa2c

Browse files
authored
fix: update 'Maintainability Index' metric comment message (#488)
1 parent 006f077 commit de4aa2c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* feat: improve unused files check, add support for `vm:entry-point` annotation.
99
* fix: compute NumberOfParametersMetric only for functions and methods.
1010
* fix: skip synthetic tokens while compute 'Source lines of Code'.
11+
* fix: update 'Maintainability Index' metric comment message.
1112

1213
## 4.3.3
1314

lib/src/analyzers/lint_analyzer/metrics/metrics_list/maintainability_index_metric.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ class MaintainabilityIndexMetric extends FunctionMetric<int> {
9595

9696
@override
9797
String commentMessage(String nodeType, int value, int? threshold) {
98-
final exceeds = threshold != null && value > threshold
99-
? ', exceeds the minimum of $threshold allowed'
98+
final exceeds = threshold != null && value < threshold
99+
? ', below the minimum of $threshold allowed'
100100
: '';
101-
final index = '$value maintability index';
101+
final index = '$value maintainability index';
102102

103103
return 'This $nodeType has $index$exceeds.';
104104
}

test/analyzers/lint_analyzer/metrics/metrics_list/maintainability_index_metric_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ Future<void> main() async {
5151
expect(metricValue.level, equals(MetricValueLevel.warning));
5252
expect(
5353
metricValue.comment,
54-
equals('This method has 46 maintability index.'),
54+
equals(
55+
'This method has 46 maintainability index, below the minimum of 50 allowed.',
56+
),
5557
);
5658
expect(metricValue.recommendation, isNull);
5759
expect(metricValue.context, isEmpty);

0 commit comments

Comments
 (0)