1

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...

szkra
  • 1,423
  • 2
  • 14
  • 21

2 Answers2

1

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...

Patrick from NDepend team
  • 13,237
  • 6
  • 61
  • 92
0

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?