I recently gave a talk about the Interface Segregation Principle in SOLID and wanted a way to easily find areas where I had broken the principle. I found a few free tools that gave some simple views but nothing great. Then I remembered hearing about nDepend on a podcast somewhere and decided to try it.

NDepend is a powerful static code analysis tool for .NET code. Here is a screen shot of the default analysis report for the ConCode.NET application we built for the 2016 dotnet.Conf Local event in Birmingham, AL.

You can see we have a debt score of “B” which isn’t too bad but definitely room for improvement. There is also a time estimate to get to the “A” rating. You can dig through debt hotspots and find types that need refactoring to increase the rating. It even gives you an estimate for how long each refactoring will take.

NDepend integrates right into Visual Studio as well which makes it very easy to analyze and fix your code inside of a single IDE.

NDepend comes with around 130 analysis rules that is uses to analyze your code by default. You can customize and add your own rules as well using C# Linq queries.

There are SO MANY features of NDepend, I’m only beginning to scratch the surface. The trend charts look especially cool for longer running projects so we can track our debt (hopefully the decrease of) over time.

.NET Core Support

I have used some of the architectural analysis features in Visual Studio in the past as well but those don’t appear to work yet with .NET Core projects but NDepend works great with .NET Core. Even if it did the NDepend tools are superior.

Summary

Full disclosure, NDepend did give me a free license to use in my presentations and write this blog post. Free license or not NDepend is the very best code analysis tool I’ve seen for .NET. I look forward to continuing to use it both personally and professionally. If you need to get a handle on your technical debt NDepend is the very best way to do it quickly and correctly. It’s also a great tool to teach you what technical debt is and how to avoid it going forward. So many of these concepts are hard to grasp but NDepend makes it much easier to find and understand them. I suspect it will be much easier to see/avoid issues in the future as I’m coding because of what I’m learning from NDepend.

A free 14-day trial is available at http://www.ndepend.com/download Try it today!

Happy Analyzing!