转载自: http://www.projectcodemeter.com/cost_estimation/help/GL_maintainability.htm

 

ProjectCodeMeter

Maintainability Index (MI)

[article cited from Wikipedia]

Maintainability Index is a software metric which measures how maintainable (easy to support and change) the source code is. The maintainability index is calculated as a factored formula consisting of Lines Of CodeCyclomatic Complexity and Halstead volume. It is used in several automated software metric tools, including the Microsoft Visual Studio 2010 development environment, which uses a shifted scale (0 to 100) derivative.

Calculation

First we need to measure the following metrics from the source code:

  • V = Halstead Volume
  • G = Cyclomatic Complexity
  • LOC = count of source Lines Of Code (SLOC)
  • CM = percent of lines of Comment (optional)

From these measurements the MI can be calculated:

The original formula:
MI = 171 - 5.2 * ln(V) - 0.23 * (G) - 16.2 * ln(LOC)

The derivative used by SEI is calculated as follows:
MI  = 171 - 5.2 * log2(V) - 0.23 * G - 16.2 * log2 (LOC) + 50 * sin (sqrt(2.4 * CM))

The derivative used by Microsoft Visual Studio (since v2008) is calculated as follows:
MI = MAX(0,(171 - 5.2 * ln(Halstead Volume) - 0.23 * (Cyclomatic Complexity) - 16.2 * ln(Lines of Code))*100 / 171)

In all derivatives of the formula, the most major factor in MI is Lines Of Code, which effec

相关文章:

  • 2021-08-24
  • 2021-12-24
  • 2021-06-21
  • 2021-05-20
  • 2021-08-15
  • 2022-01-04
  • 2021-09-08
  • 2022-12-23
猜你喜欢
  • 2022-02-20
  • 2021-11-23
  • 2022-01-22
  • 2021-12-14
  • 2022-01-15
  • 2021-09-29
  • 2021-09-28
相关资源
相似解决方案