[代码质量] Maintainability Index (MI)
转载自: 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 Code, Cyclomatic 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
[代码质量] Maintainability Index (MI)的更多相关文章
- [代码质量] 代码质量管控 -- 复杂度检测 (JavaScript)
转载自: https://juejin.im/post/59bb8b546fb9a00a4247532e 背景 代码的复杂度是评估一个项目的重要标准之一.较低的复杂度既能减少项目的维护成本,又能避免一 ...
- sonar的安装与代码质量检测实例
说明:sonar依赖数据库. mysql优化 1.笔者使用的是mysql数据库.首先对mysql做简单的优化配置. [root@localhost bin]# cat /etc/my.cnf [mys ...
- ESLint 检查代码质量
利用 ESLint 检查代码质量 其实很早的时候就想尝试 ESLint 了,但是很多次都是玩了一下就觉得这东西巨复杂,一执行检查就是满屏的error,简直是不堪入目,遂放弃.直到某天终于下定决心深入看 ...
- MDU某产品OMCI模块代码质量现状分析
说明 本文参考MDU系列某产品OMCI模块现有代码,提取若干实例以说明目前的代码质量,亦可作为甄别不良代码的参考. 本文旨在就事论事,而非否定前人(没有前人的努力也难有后人的进步).希望以史为鉴,不破 ...
- [代码质量] 推荐一个vs自带工具分析代码的复杂度
转载自: https://blog.csdn.net/zh_geo/article/details/52954145 VS2012 -> Analyze -> Calculate code ...
- 《设计模式之美》 <02>评判代码质量好坏的维度
如何评价代码质量的高低? 实际上,咱们平时嘴中常说的“好”和“烂”,是对代码质量的一种描述.“好”笼统地表示代码质量高,“烂”笼统地表示代码质量低.对于代码质量的描述,除了“好”“烂”这样比较简单粗暴 ...
- 提高代码质量 CheckStyle FindBugs PMD
提高代码质量-工具篇 注:这是一篇翻译文章,原文:How to improve quality and syntax of your Android code,为了理解连贯,翻译过程中我修改了一些陈述 ...
- 重读 code complete 说说代码质量
重读code complete 说说代码质量 2014年的第一篇文章本来计划写些过去一年的总结和新年展望,但是因为还有一些事情要过一阵才能完成,所以姑且不谈这个,说说最近重读code complete ...
- 使用JSLint提高JS代码质量
随着富 Web 前端应用的出现,开发人员不得不重新审视并重视 JavaScript 语言的能力和使用,抛弃过去那种只靠“复制 / 粘贴”常用脚本完成简单前端任务的模式.JavaScript 语言本身是 ...
随机推荐
- python关于try except的使用方法
一.常见错误总结 AttributeError 试图访问一个对象没有的树形,比如foo.x,但是foo没有属性x IOError 输入/输出异常;基本上是无法打开文件 ImportError 无法引入 ...
- Centos7搭建Harbor私有仓库(一)
1 说明 前文Centos7搭建DockerRegistry介绍了DockerRegistry的搭建,但它没有UI页面,因此选择Harbor 以下基于镜像CentOS-7-x86_64-Minimal ...
- sqlserver 智能提示插件
文章:SqlServer智能提示插件SQLPrompt 地址:https://blog.csdn.net/u013628152/article/details/83274478
- 微信小程序~TabBar底部导航切换栏
底部导航栏这个功能是非常常见的一个功能,基本上一个完成的app,都会存在一个导航栏,那么微信小程序的导航栏该怎么实现呢?经过无数的踩坑,终于实现了,好了,先看看效果图. 对于底部导航栏,小程序上给出的 ...
- c#2.0锐利体验《泛型编程》读书笔记
1.c#泛型及机制 Class Stack<T> { } T 其实为type的缩小,不过也可为其他字符代替T ,被称为“泛型类型” T为晚绑定的,在编译的时候还不能确定T的确切类型. 2 ...
- [Dynamic Programming] 198. House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount ...
- TED演讲:真正拉开你与周围人之间差距的,是自学能力https://www.bilibili.com/video/av65904878/?spm_id_from=333.788.videocard.1
conference.summitcouplecapital.topvillageperfecthonestpreciselyEurope.scholarshipforcefalsefoxrealit ...
- LeetCode 1049. Last Stone Weight II
原题链接在这里:https://leetcode.com/problems/last-stone-weight-ii/ 题目: We have a collection of rocks, each ...
- lxml 和 pyquery 示例 爬 卡牌
import requests from pyquery import PyQuery as pq import json import jsonpath from lxml import etree ...
- High scalability with Fanout and Fastly
转自:http://blog.fanout.io/2017/11/15/high-scalability-fanout-fastly/ Fanout Cloud is for high scale d ...