Assessing the quality of an application’s code is often a subjective process. This is why we turn to code metrics — quantitative measurements that provide valuable insights into our application’s code. Developers can take advantage of code metrics to understand the quality of the code, get an idea of the potential problems, and identify which types and methods need to be refactored to improve the quality.
Static code analysis tools are used to measure the quality of code in an application without having to execute the application. There are many static code analysis tools available for .Net. These include FxCop, StyleCop, ReSharper, CodeIt.Right, NDepend, etc. This article presents a discussion of how we can use NDepend to visualize code quality and adopt measures to improve it.
What is NDepend and why use it?
NDepend is a static code analyzer that integrates nicely with Visual Studio and provides valuable metrics for determining code quality. NDepend displays these metrics in the form of lists, matrixes, graphs, tree maps, and charts. Along with these metrics, NDepend can analyze your code and report violations against a large database of rules.
NDepend saves the results of each analysis, so you can compare the results after you’ve improved upon the code coverage or code quality. It can be run both as a standalone application and as an extension in Visual Studio. And you can take advantage of the NDepend Azure DevOps extension to integrate NDepend with your projects in Azure.
The following are some of the striking features of NDepend: