calculateMaintainabilityIndex method
Calculates maintainability index.
Implementation
double calculateMaintainabilityIndex({
required double halsteadVolume,
required int cyclomaticComplexity,
required int linesOfCode,
}) {
if (linesOfCode <= 0 || halsteadVolume <= 0) {
return 100.0;
}
final mi = 171 -
5.2 * math.log(halsteadVolume) -
0.23 * cyclomaticComplexity -
16.2 * math.log(linesOfCode);
return math.max(0, mi * 100 / 171);
}