Tuesday, 3 December 2013

Improving code quality by using NDepend v5

Previously I’ve written about NDepend, a static analysis tool design to improve code quality by using code metrics and enforcing a series of rules. I was particularly impressed by the CQLinq feature, that allows you to write LINQ-style queries to check your code for certain rules. Since then NDepend 5 has been released, and I thought it’s time I checked it out.

The new features in this release include:

  • Support for Visual Studio 2013.
  • A new dashboard panel that shows the state of your code base at a glance.
  • Customisable trend metrics and charts.
  • Listing rules and queries according to a specific criteria, such as showing all the rules that have been violated.

Obviously, there’s a lot more new in NDepend 5 than I’ve listed here. For a full list see What’s new in NDepend v5.0.

I thought I’d put it through its paces by running it on a project I’m working on. Once NDepend has analysed your project it produces a HTML report that contains an overview of it’s findings.

image

The report then allows you to drill down into the findings. My starting point was to switch to the new dashboard view to examine the data.

dashboard[2]

Previously the overview of NDepend’s findings was pretty complicated. However, this isn’t the case with the new dashboard. While there’s a lot of information presented, it’s pretty easy to navigate through it. All the data that was available in previous releases of NDepend is still present. For more info see my previous blog post about NDepend.You can also turn off specific rules and queries that are producing violations that you find acceptable.

One of the great new features is its ability to display trend charts. It seems like it’d be a particularly useful feature for those on a team who are concerned with developer productivity.

Overall this latest release of NDepend has a much improved and responsive UI, and performs its analysis quickly. I’d imagine that a key scenario where NDepend would come into its own is tracking refactoring across a project, in order to gain a high level overview of the effect that the refactoring is having, while also being able to drill down into issues caused by specific refactoring's. In such scenarios NDepend would fit the bill perfectly.

No comments:

Post a comment