Measurement of Maintainability Index (MI) with Testwell CMT++ and CMTJava (Complexity Measures Tools)
Testwell CMT++ and Testwell CMTJava support Lines-of-code-metrics, Halsteads Metrics, McCabe Metrics and the Maintainability Index (MI).
MI is a single-number value for estimating the relative maintainability of the code.
Maintainability Index is calculated with certain formulae from lines-of-code measures, McCabe measure and Halstead measures.
The measurement and track maintainability are intended to help reduce or reverse a system's tendency toward "code entropy" or degraded integrity, and to indicate when it becomes cheaper and/or less risky to rewrite the code instead to change it.
There are two variants of Maintainability Index: one that contains comments (MI) and one that does not contain comments (MIwoc). CMT++ and CMTJava calculate them both.
Meanings of the Maintainability Index (MI, with comments) values:
To realize the full benefit of MI, the maintenance environment must allow the rewriting of a module when it becomes measurably unmaintainable. The point of measuring the MI is to identify risk; when unacceptably risky code is identified, it should be rewritten.
Calculation of Maintainability Index
Maintainability Index is calculated on each function/class/struct, on each file and on all files together level.
Actually there are three measures:
The general formulae for MI is the following:
MIwoc = 171 - 5.2 * ln(aveV) -0.23 * aveG -16.2 * ln(aveLOC)
MIcw = 50 * sin(sqrt(2.4 * perCM))
MI = MIwoc + MIcw
aveV = average Halstead Volume (CMT++/CMTJava´s V) per module
"module" is (in CMT++ case) a C-like function definition, a C++-like member function definition, or a class/struct definition.
further information about Maintainability Index:
further information about Testwell Complexity Measures Tools:
last updated: 24.05.2011
© 2006-2011 Testwell Oy / Verifysoft Technology GmbH