DEV Community

CodingBlocks

Episode 15 – NDepends on How Good Your Code Is

This week we're discussing NDpend, a static analysis tool for .NET. Triage your biggest problems, Prioritize your refactoring, and CYA with real metrics and trend lines. We also discuss hidden nuggets, Pintrest-envy, and we pour another one out for google reader. News Check out our YouTube channel! Angular 2.0 is coming! Beginning XML in SQL Server With Don Wert Thanks for the reviews RyGuyWelch and glenster75! NDepend Overview We received a free license for NDepend, and decided to check it out What is NDepend and what does it do for you? Had some stability issues initally, Allen's problem turned out to be Visual Studio Tools for Git Build Server license/version - perfect for your CI server Tons of functionality Features Circle at the bottom right seems to be the quick key to navigating or the NDepend Menu in VS Dashboard - quick glance at all the top items you should be trying to attend to in your project/solution graphs changes over time (between snapshots) Queries and rules explorer are very powerful - nice that you can actually see and modify the Linq that's used to create the various reports - makes this incredibly flexible View Reports of any number of coding issues... Complexity report is a real eye opener ILCC - IL Cyclomatic Complexity - anything over 20 should probably be refactored Joe's post Static Analysis of Open Source .NET Projects Dependency graphs - neat Dependency Matrix Diff snapshots - Compare different versions of your code Trend charts - track your progress! Code metric view gives you a sense of the size of the various areas of your code Import Code Coverage from tools like dotCover Visual NDepend Standalone, VS Plugin, and Build Versions What we love Awesome rules, categories include Architecture and Layering Code Quality Dead Code Design Naming Conventions Object Oriented design Visibility Love the Dependency Graph - ability to highlight objects (size) based off lines of code, dependencies, etc Generated html report doesn't have the functionality of the dashboard, but it is convienient The Abstractness versus Instability Diagram helps to detect which assemblies are potentially painful to maintain (i.e concrete and stable) and which assemblies are potentially useless (i.e abstract and instable). Abstractness: If an assembly contains many abstract types (i.e interfaces and abstract classes) and few concrete types, it is considered as abstract. Stability: An assembly is considered stable if its types are used by a lot of types of tier assemblies. In this conditions stable means painful to modify. The big benefit is tracking your project over time Very friendly UI: Clicked "Generate a graph of..." brought up screenshots of how it works Checkbox for "Recent rules violated" Create trend chart What we're not so crazy about Occasionally awkward interface, shows the code for the rules rather than a description Wish it had easy support for assembly segregation - (could do separate reports) Doesn't honor the Visual Studio theme The UI windows show up somewhat randomly (VS issue?) Tons of info: Multiple monitors is pretty much a necessity for using NDepend Irritating that double-clicking a column header in the grids shrinks down the column to nothing rather than auto-expanding When looking at the reports, mousing over a row pops up the details, although I wish it would lock to the row selected (if you have selected a row) Manual installation process Not seamless, needs to "attach" to a solution Requires .NET 3.5 (for backwards compatibility?) What we'd like to see in future versions Reports that are more "shareable" Analysis of more than .NET code, i.e. HTML, Javascript, etc Github and source control history integration! Resources We Like Pluralsight, of course Static Analysis of Open Source .NET Projects The Steve Balmer Ipsum Generator

Episode source