Validating Code Quality with NDepend
Patrick Smacchia’s NDepend is a great tool to improve code quality and should be run quite regularly. It can be run as a strand alone GUI tool, from inside Visual Studio and as part of your build process. I’ll use the tool over the next few weeks to analyze and improve the quality of one of my personal code bases. I’ll try to share my experiences beside tips and tricks as well as giving feedback to Patrick.
Code Rules an Queries
At first I’d like to highlight one of the most powerful features: Code Rules an Queries. This lets query your code base over LINQ queries thanks to CQLinq. There are about 200 default rules. The power really evolves as you start customizing these and further on start writing your own rules.
Here is an example:
from m in Application.Methods where m.NbLinesOfCode > 30 && m.IsPublic select m
And a screenshot of the Editor:
As X-Mas is soon I’ll write down a few things I would have expected or that would improve the tooling experience.
Tab a selection in “Query and Rules Edit”
Currently a tab on a selected range removes the range. Tabbing helps me to keep code readable.