CodeImprover Technical Reference

Metric Name:

Maintainability Index


The maintainability index is a complex calculation performed on each method. The calculation includes the number of:

  • Operands
  • Unique operands
  • Operators
  • Unique operators
  • Lines of source code in the method
  • Cyclomatic complexity

This is in order to indicate how maintainable the code is. The higher the index value the better maintainability. CodeImprovers implements the maintainability index similar to how it is done in Visual Studio. The mathematical formula can be found here.

Default setting:

Any method with a maintainability index value below 50 triggers negative Observations Score points.


Even though the formula behind the maintainability index is an academic piece of math, it is a good indication of the maintainability of your code.

What to do:

As this metric includes many parameters and involves complicated empirical derived calculations, it is not possible to precisely point out a solution. Usually, a good place to start is to break down the larger methods into smaller methods. Apart from improving the index, it is also a general remedy for other code quality issues.

Context – How it works
Back to – Metrics reference overview