Thursday, November 18, 2004

This is a preview of a new Reflector Addin that computes various CodeMetrics on .Net assemblies. The excellent Reflector API makes it very easy to do this kind of things. Here are the metrics that I plan to implement :

  • Counting metrics: Module/Assembly, Type/Module, Method/Type, etc...
  • IL counting metrics: IL/Method, LocalVariables/Method, ExceptionHandlers/Method, etc...
  • IL flow graph metrics: components, cyclomatic complexity,
  • Method graph: methodrank, callers, callees, components, distance from entry point,
  • Type graph: type rank, inherance level, etc...

I have not done an extensive research on the subject so I might forget a lot of them, suggestions and links welcome.

Note that this uses a plugin architecture so that anyone can write and use his own metric.

Screenshot:

posted on Thursday, November 18, 2004 10:50:00 AM UTC  #    Comments [18]
Tracked by:
"kasper antivirus" (online) [Trackback]
"horse pedigree" (online) [Trackback]
Monday, June 06, 2005 4:53:32 PM UTC
Man I love your work!
<br>Keep it up.
pieter
Monday, June 06, 2005 4:53:33 PM UTC
This really is a great way to do metrics. Cyclomatic, fan in and fan out are very useful in identifying places to refactor.
<br>
<br>It would be really cool to persist these to store (probably a file). Then I can incorporate them into my <a title="Documentation Compiler Tool" href="http://ndoc.sourceforge.net" target="_blank">NDoc</a> documentation. Maybe save as XML in a file and extract into my own format stored in XHTML file or even in the source!
Mike Gale
Monday, June 06, 2005 4:53:33 PM UTC
Good idea mike, I add serialization possiblities.
Jonathan de Halleux
Monday, June 06, 2005 4:53:33 PM UTC
How exactly do you define FanIn and FanOut ?
Jonathan de Halleux
Monday, June 06, 2005 4:53:33 PM UTC
Andrew Stopford's Weblog
Monday, June 06, 2005 4:53:33 PM UTC
When can we get a hold of this? :)
Christian Duhard
Monday, June 06, 2005 4:53:34 PM UTC
See post above.
Jonathan de Halleux
Monday, June 06, 2005 4:53:34 PM UTC
Hello,
<br>
<br>Maybe you can take a look to the free software NDepend written by Patrick Smacchia :
<br>
<br><a target="_new" href="http://smacchia.chez.tiscali.fr/NDepend.html">http://smacchia.chez.tiscali.fr/NDepend.html</a>
<br>
<br>It's quite complete. It still uses ILReader by Lutz Roeder to work on CIL stuff, but it should not be very hard to modify it to use Refletor's CodeModel, and use it as a plugin.
<br>
<br>Jb
<br>
Jb Evain
Monday, June 06, 2005 4:53:34 PM UTC
I like the CodeMetrics add-in better than NDepend. It is easier to use and doesn't fail on tricky assemblies. I'm sure all metrics will get added to <a title="Reflector" href="http://www.aisto.com/roeder/dotnet/" target="_blank">Reflector</a>.CodeMetrics soon :-).
Ork
Monday, June 06, 2005 4:53:34 PM UTC
Thanks Orb,
<br>
<br>I knew about NDepend and VIL but it is more fun to implement those metrics myself. It was far easier for me to build things from scratch that try to integrate an existing contecpt.
<br>
<br>Moreover, <a title="Reflector" href="http://www.aisto.com/roeder/dotnet/" target="_blank">Reflector</a>.CodeMetrics has new metrics such as MethodRank (or upcoming TypeRank) that neither tool can build.
Jonathan de Halleux
Monday, June 06, 2005 4:53:34 PM UTC
In addition to serialization, is there a way to get this to run as a command line so we can take the output and upload it to a database each week? We run FxCop like this to get an idea of the overall codebase quality.
Cleve Littlefield
Monday, June 06, 2005 4:53:35 PM UTC
I'll add that to my todo list...
Jonathan de Halleux
Monday, June 06, 2005 4:53:35 PM UTC
Where can I download the CodeMetrics <a title="Reflector" href="http://www.aisto.com/roeder/dotnet/" target="_blank">Reflector</a> ?
Wyatt Wong
Monday, June 06, 2005 4:53:35 PM UTC
On the download page of www.dotnetwiki.org
<br>
Jonathan de Halleux
Monday, June 06, 2005 4:53:35 PM UTC
SDFSDF
VFSDFG
Monday, June 06, 2005 4:53:37 PM UTC
Very nice.
<br>
<br>Any detailed definitions.
<br>Also would be nice to know what are good/bad/average results.
<br>
<br>Thanks,
<br>Schneider
Eric Schneider
Monday, June 27, 2005 12:18:07 AM UTC
Hi, could you send me ILReader? All links are broken :(

Thankx
Libor
Monday, June 27, 2005 12:22:44 AM UTC
I am not the author of ILReader. Ask Lutz Roeder, thanks.
Comments are closed.