The Maintainability Index (MI) is a composite score that blends Halstead volume, cyclomatic complexity, and SLOC into a single number representing how maintainable a unit of code is. mehen reports all three commonly used variants.Documentation Index
Fetch the complete documentation index at: https://mehen.ophi.dev/llms.txt
Use this file to discover all available pages before exploring further.
What mehen emits
| Key | Type | Variant |
|---|---|---|
mi.original | float | Oman & Hagemeister, 1992 (raw, can be negative). |
mi.visual_studio | float | Microsoft Visual Studio rescale to 0–100. |
mi.sei | float | Software Engineering Institute (SEI) variant including comment ratio. |
Formulas
Original (Oman & Hagemeister, 1992)
V_avg, CC_avg, LOC_avg are averages across the unit.
Visual Studio (rescaled 0–100)
Microsoft rescaled MI to a 0–100 range so a single threshold could be applied across files:SEI (with comment ratio)
The SEI variant adds a documentation term:CM is the ratio of comment lines to total lines.
How to read it
mi.visual_studio | Interpretation (Visual Studio default) |
|---|---|
| 20–100 | Maintainable (green). |
| 10–19 | Moderately maintainable (yellow). |
| 0–9 | Hard to maintain (red). |
References
- Oman, P. & Hagemeister, J. (1992). Metrics for assessing a software system’s maintainability. Proc. Conf. on Software Maintenance. DOI.
- Coleman, D., Ash, D., Lowther, B. & Oman, P. (1994). Using metrics to evaluate software system maintainability. Computer 27(8): 44–49. DOI.
- Welker, K. D. (2001). The Software Maintainability Index Revisited. CrossTalk — The Journal of Defense Software Engineering, August 2001. PDF (DTIC archive).
- Microsoft: Code metrics — Maintainability Index range and meaning.
- Radon: Maintainability Index reference implementation.
See also
- Halstead metrics — input for MI.
- Cyclomatic complexity — input for MI.
- LOC family — SLOC and CLOC are inputs.