c# - How to measure RFT metric in NDepend? -
does ndepend have direct way measure rfc (rft) cql? or have write cql query recursive counting invoked methods in used classes (types) our-self? if so, how like? this?
this indeed possible magic filliterative() method. issue code query can take few seconds run , might need adjust query time-out (set 2 seconds per default). notice performance cost due rft definition, doesn't come problem algorithm used.
here code:
// <name>rft</name> t in application.types !t.isinterface && !t.isenumeration let methodsuseddirectly = t.typesused .where(tused => !tused.isthirdparty) .childmethods() .where(m => m.isusedby(t)) let methodsusedindirectly = methodsuseddirectly .filliterative( methods => methods.selectmany( m => m.methodscalled .where(mcalled => !mcalled.isthirdparty)) ) .definitiondomain.toarray() let rftloc = methodsusedindirectly.sum(m=>m.nblinesofcode) select new { t, methodsuseddirectly, methodsusedindirectly, rft = methodsusedindirectly.length, rftloc }
by running query, not rft measure each type, rft in terms of lines of code (i.e sum of loc of methods in response) , can each type, lists methods in response.
Comments
Post a Comment