Sonar参数分析

上传人:豆浆 文档编号:733551 上传时间:2017-05-12 格式:DOCX 页数:18 大小:59.77KB
返回 下载 相关 举报
Sonar参数分析_第1页
第1页 / 共18页
Sonar参数分析_第2页
第2页 / 共18页
Sonar参数分析_第3页
第3页 / 共18页
Sonar参数分析_第4页
第4页 / 共18页
Sonar参数分析_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《Sonar参数分析》由会员分享,可在线阅读,更多相关《Sonar参数分析(18页珍藏版)》请在金锄头文库上搜索。

1、Sonar 参数分析API compatibility1. API behavior changes-Clirr Plugin正常接口变化数2. API breaks-Clirr Plugin可能引发错误的接口变化3. New API-Clirr Plugin新增接口数4. Total API Changes-Clirr Plugin接口变化总数注:以上参数需要依赖于 Clirr,暂时仍存在问题Architecture5. Architecture- Total Quality Plugin架构质量计算方式:ARCH = 100 TITI = Tangle Index6. Architectu

2、re Tangle Index- Total Quality Plugin架构复杂指标Complexity7. Complexity默认复杂度8. Complexity /class默认类复杂度9. Complexity /file默认文件复杂度10. Complexity /method默认方法复杂度11. Complexity Factor- Quality Index Plugin复杂度因素计算方式:CF = (5 * Complexity30) * 100 / (Complexity1 + Complexity10 + Complexity20 + Complexity30)12. C

3、omplexity Factor Methods- Quality Index Plugin方法复杂度因素13. QI Complexity-Quality Index Plugin复杂度质量指标计算方式:(Complexity30 *10 + Complexity20 * 5 + Complexity10 * 3 + Complexity1) / validLinesDesign14. Design Classes and Methods Complexity- Total Quality PluginNOM = (1 - (class_complexity - 12) / (acel *

4、12) * 50 + (1 - (method_complexity - 2.5) / (acel * 2.5) * 50 参见 1915. Design Coupling Between Objects- Total Quality PluginCBO = (1 - (efferent_coupling - 5) / (acel * 5) * 100 参见 1916. Design Depth of Inheritance Tree- Total Quality PluginDIT = (1 - (depth_of_inheritance_tree - 5) / (acel * 5) * 1

5、00 参见 1917. Design Lack of Cohesion of Methods- Total Quality PluginLCOM = (1 - (lack_of_cohesion_of_method - 1) / (acel * 1) * 100 参见 1918. Design Response for Class- Total Quality PluginRFC = (1 - (response_for_class - 50) / (acel * 50) * 100 参见 1919. Design Quality- Total Quality Plugin设计质量计算方式:D

6、ES = 0.15*NOM + 0.15*LCOM + 0.25*RFC 0.25*CBO + 0.20*DITNOM = (1 - (class_complexity - 12) / (acel * 12) * 50 + (1 - (method_complexity - 2.5) / (acel * 2.5) * 50LCOM = (1 - (lack_of_cohesion_of_method - 1) / (acel * 1) * 100RFC = (1 - (response_for_class - 50) / (acel * 50) * 100CBO = (1 - (efferen

7、t_coupling - 5) / (acel * 5) * 100DIT = (1 - (depth_of_inheritance_tree - 5) / (acel * 5) * 100Acel 参数因子的值可以在 Sonar setting 页面配置。每一个度量标准的默认阙值也可以进行配置(例如, 50 是 response_for_class 的默认阈值 ) 。20. LCOM4(Lack of cohesion of methods)用来说明 class 内部方法和变量之间的关系, 值越大, 说明内聚性越差. 一般情况下 LCOM4=1 是内聚性最佳的. 2 说明可以拆成两个类, 以

8、此类推 .但是这种测量对门面服务类来说不适用. 有时候很小的类也会根据需要合并在一起, 尽管关联不大21. Package tangle index包复杂指数此参数为包的复杂等级,最好的值为 0%,意味着包之间没有圈依赖;最差的值为 100%,意味着包与包之间的关系特别的复杂。该指数的计算公式:2 * (package_tangles / package_edges_weight) * 100.22. RFC(Response for Class)通过检查一个方法被调用的情况来反映一个 class 的复杂程度 . 也可以简单的理解为一个类所包含的方法多寡.23. Suspect LCOM4 d

9、ensityLCOM4 密度值Documentation24. Comment linesJavadoc、多行注释、单行注释的总数。空注释行、头文件中的注释(主要用于定义许可证)以及 commented-out 行均不会包括在内。25. Commented-out LOC注释掉的代码行数。Javadoc 块不会被扫描26. Comments (%)注释行数/(注释行数+有效代码行数)27. Public documented API (%)添加注释的公有 API 占总的公有 API 的百分比28. Public undocumented API公有 API 未添加注释个数Duplication

10、29. DRYness - Total Quality PluginDRYNESS = 100 - Duplicated lines density30. Duplicated blocks重复块数31. Duplicated files重复文件数32. Duplicated lines重复行数33. Duplicated lines (%)重复行占总行数的百分比34. Useless Duplicated Lines-Useless Code Tracker无用的重复行数;当前的 Sonar 告诉你有 50 重复的行数,但是不能告诉你是有两块25 行的代码重复(这样你可以节省 25 行代码)

11、还是有 5 块 10 行(这样你可以节省40 行代码)的代码重复;通过这个插件,你可以获取到额外的信息。General35. Analysability Value- SIG Maintainability Model可理解性请查看 37 指标后的详细介绍36. Changeability Value- SIG Maintainability Model可扩展性37. Stability Value- SIG Maintainability Model稳定性38. Testability Value- SIG Maintainability Model可测试性可维护性可通过 7 个质量特性来衡

12、量 :可理解性可测试性可修改性可靠性可移植性可使用性效率这个插件标示了一个 Software Improvement Group(SIG)可维护性模型这个模型需要两步: 计算基数的指标,然后结合他们计算出更高层面上的数值。每一个指标被分成 5 级别排名:从 -(很糟糕)到+(非常好)第一步加上基数的指标。Volume: 基于代码的行数Rank LOC - 1310000- 6550000 246000+ 66000+ 0 Duplications: 基于代码重复的密度Rank Duplication- 20%- 10%0 5%+ 3%+ 0% Unit tests: 基于单元测试覆盖率Rank

13、 Coverage+ 95% + 80%0 60%- 20%- 0%Complexity:基于方法的圈复杂度第一步根据圈复杂度的范围确定在方法代码行中的百分比。Eval Complexity Very high 50 High 20 Medium 10 Low 0 然后根据分布,我们使用下面的表格来计算等级:Rank Medium High Very High + 100High 50 Medium 10 Low 0 然后根据分布,使用下面的表格来计算等级:Rank Medium High Very High + 25% 0% 0% + 30% 5% 0% 0 40% 10% 0% - 50%

14、 15% 5% 否则等级为-第二步是通过一个简单的平均,将他们结合起来,使用以下映射表来确定最终等级.Volume Complexity Duplications Unit size Unit testsanalysabilitychangeabilitystabilitytestability因此 4 个代表软件可维护性四维的先进指标。可选项,通过将 4 个指标简单的结合在一块,可以得到可维护性排名。需要注意的是,图表的颜色代表实际结合后的值,从红色=-到绿色=+.39. Profile version 未知未知40. Quality Index- Quality Index Plugin计

15、算方式:QI = 10 - 4.5 * coding - 2 * complexity - 2 * coverage -1.5 * style41. SIG MM- SIG Maintainability ModelSIG 可维护性模型,参考 3742. Technical Debt ($)-Technical Debt Plugin清除所有技术债务需要的花费43. Technical Debt in days-Technical Debt Plugin需要多少人日去解决技术债务44. Technical Debt ratio-Technical Debt Plugin技术债务占整个项目的比例45. Total Quality- Total Quality Plugin总体质量计算方式:TQ= 0.25*ARCH + 0.25*DES + 0.25*CODE + 0.25*TSManagement46. Burned budget燃尽预算47. Business value商业价值48. Team size团队规模注:以上变量为手动输入变量,另外这里可以添加一些自定义的变量Rules49. Blocker violations阻碍性违规50. Code Quality- Total Quality Plugin代码质量计算方式:Code = 0.15*DOC + 0.45*

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 电子/通信 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号