来自 Ndepend 的 C# 项目的 CK 指标

发布于 2024-10-08 22:41:53 字数 153 浏览 3 评论 0原文

我有学校项目。现在我需要从中生成所有指标 CK(Chidamber Kemerer 指标)的报告。该报告必须类似于所有这些指标的表格。问题是如何从 Ndepend 生成它生成的报告,它不是我想要的。

请帮助并说明如何做到这一点...也许一些提示、文件或其他非常重要的东西...

I have project for school. Now I need to make from it report of all metrics CK (Chidamber Kemerer metrics). The report has to be like table of all those metrics. Question is how to make it from Ndepend this report which it generates it is not what I am looking for.

Please help and say how to do it... maybe some tips, documents or something this is very important...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

锦爱 2024-10-15 22:41:53

好的,如果我们谈论这些 Chidamber Kemerer 指标NDepend 能够编写 代码查询和 LINQ 查询规则 (CQLinq) 将满足您的所有需求。例如:

WMC 每个类的加权方法

warnif count > 0 
from t in Application.Types
let methods = t.Methods
   .Where(m => !m.IsPropertyGetter && 
               !m.IsPropertySetter &&
               !m.IsConstructor)
where methods.Count() > 20
orderby methods.Count() descending
select new { t, methods }

DIT 继承树深度

warnif count > 0 
from t in JustMyCode.Types 
where t.IsClass
let baseClasses = t.BaseClasses.ExceptThirdParty()
where baseClasses.Count() >= 5
select new { t, baseClasses, 
                // The metric value DepthOfInheritance takes account
                // of third-party base classes
                t.DepthOfInheritance 
}

NOC 子级数量

from t in Types 
where t.IsClass
let childClasses = t.DerivedTypes
where childClasses.Count() > 0
orderby childClasses.Count() descending 
select new { t, childClasses }

CBO 对象类之间的耦合

from t in Application.Types 
let typesUsed = t.TypesUsed.ExceptThirdParty()
orderby typesUsed.Count() descending 
select new { t, typesUsed }

等等...

Ok, so if we are talking of these Chidamber Kemerer metrics, the NDepend ability to write Code Queries and Rules over LINQ queries (CQLinq) will answer all your needs. For example:

WMC Weighted Methods Per Class

warnif count > 0 
from t in Application.Types
let methods = t.Methods
   .Where(m => !m.IsPropertyGetter && 
               !m.IsPropertySetter &&
               !m.IsConstructor)
where methods.Count() > 20
orderby methods.Count() descending
select new { t, methods }

DIT Depth of Inheritance Tree

warnif count > 0 
from t in JustMyCode.Types 
where t.IsClass
let baseClasses = t.BaseClasses.ExceptThirdParty()
where baseClasses.Count() >= 5
select new { t, baseClasses, 
                // The metric value DepthOfInheritance takes account
                // of third-party base classes
                t.DepthOfInheritance 
}

NOC Number of Children

from t in Types 
where t.IsClass
let childClasses = t.DerivedTypes
where childClasses.Count() > 0
orderby childClasses.Count() descending 
select new { t, childClasses }

CBO Coupling between Object Classes

from t in Application.Types 
let typesUsed = t.TypesUsed.ExceptThirdParty()
orderby typesUsed.Count() descending 
select new { t, typesUsed }

and so on...

岁月无声 2024-10-15 22:41:53

NDepend 在 CQL 中是否有直接方法来测量 RFC (RFT)?或者我们是否必须编写一个 CQL 查询来递归计数我们自己使用的类(类型)中调用的方法?如果是这样,它看起来怎么样?

Does NDepend have a direct way in CQL to measure RFC (RFT)? Or do we have to write a CQL query for recursive counting invoked methods in used classes (types) our-self? If so, how does it look like?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文