Hi,
I recently wrote a post here on Stackoverflow asking for some C# libraries that calculate metrics, mainly CC...unfortunately with no success. So I'm going to write it myself. I did a search on the web of what could be the best approach, but before starting I'd like to ask you on how you'd do it.
I'm currently between two kind of approaches
- Given a source code directory, to parse the source code with regex expressions or similar for identifying the constructs like methods, conditional statements etc. for being able to calculate CC
- Given an assembly, loading it and analyzing it (using CodeDom?)
I'm more for the 2nd approach, since parsing the source code directly doesn't seem to be a good approach to me. I've read about CodeDom which is integrated in the .Net framework. I know it is used for dynamic code generation. I guess I could also use it for analyzing the code structure, can't I? Does anybody of you have some good starting point of using CodeDom, some hints, good tutorials where to start?
Thanks
Edit: Or possibly some other utility that allows to parse source code easily (DOM like structure).