Use NDepend for Static Code Quality Analysis
Disclosure: I got a free pro license for NDepend.
I'm usually a bit skeptical about code analysis tools, whatever they do. However I was very impressed by NDepend - static code analysis tool developed by Patrick Smacchia. Static Code Analysis - means it is able to analyze written code while profilers usually analyze the code during runtime.
First Impressions
At a first glance the whole x-rays picture of code "hot spots" and different metrics seems a bit complicated. May be even complex or inaccessible for an average programmer. However after half an hour you get used to it and I think that the tool is of great value for the software development process.
NDepend Benefits and Features
- Provides the whole up-level picture of the product code-base.
- Provides powerful code quality analysis and audit in terms of:
- Lines of code per method threshold.
- Cyclomatic complexity (use of "for", "while", "foreach").
- Comments percentage.
- Number of IL instructions.
- Parameters/variables per method threshold.
- Methods per type threshold.
- Type cohensity ratio (most methods using most fields).
- Memory footprint bytes.
- Extra boxing and unboxing.
- Others that I missed :)
- Build Comparison (tracks version-to-version changes) like Libcheck. Actually NDepend build comparison gives far more info than libcheck.
- Refactoring.
Tool for architects
I think it is a tool for architects or analysts who are in charge of the whole development process. Usually it is 1-2 people who have a need to audit product code-base quality. Or team leaders who have enough common sense to be able to compile a TODO list, wish list and pick up some metrics to ignore having NDepend data analysis.
Code Query Language
NDepend has its own query language so one can write queries using this SQL syntax to examine assemblies, types, methods, etc.
Raymond Lewallen describes it:
"NDepend supplies over 60 quality and useful code metrics, and also has its own query language that Patrick calls CQL. Its easy to use and is part of my formal build process. Its going to be very hard for anything to dethrone NDepend as the king of code metrics."
Conclusion
I definitely recommend NDepend. Personally I am going to integrate NDepend in the development processes I'm involved in.
Saturday, March 31, 2007 4:25 AM