简体   繁体   English

如何使用Python和SciTools Understand API为类计算CBO和LCOM

[英]How to calculate CBO and LCOM for a class using Python and SciTools Understand API

In Python , how can I calculate LCOM (lack of cohesion) for C++ files (or any other file types) using SciTools Understand API ? Python中 ,如何使用SciTools Understand API计算C ++文件(或任何其他文件类型)的LCOM (缺乏内聚性)?

For an assignment, we're asked to calculate LCOM ourselves instead of using SciTools's Understand. 对于作业,要求我们自己计算LCOM,而不要使用SciTools的Understand。

To calculate LCOM4 , I need the following metrics, 要计算LCOM4 ,我需要以下指标,

  1. number of functions/methods in a class (given by Understand as " CountDeclFunction ") 一个类中函数/方法的数量(由Understand提供为“ CountDeclFunction ”)

  2. number of method pairs in class with at least one instance variable that they commonly use or define in their body. 类中带有至少一个通常在其体内使用或定义的实例变量的方法对的数量。

  3. number of method pairs in class that have at least one instance method that they commonly call in their body. 类中具有至少一个通常在其体内调用的实例方法的方法对的数量。

Any suggestion is much appreciated. 任何建议深表感谢。

通过https://scitools.com/support/metrics-reports/上列出的指标,我相信您必须开发自己的指标以补充Understand提供的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM