Code Quality Metrics with NDepend



Introduction

The quality of a software application can be determined by the quality of the codebase. Code quality analysis as over the years become an integral part of software development process, this is to ensure that developers follow best practices while writing codes to ensure that codebase is maintainable, reusable and also to determine portion or section of codes that are problematic and might be candidate for refactoring if need be.

Code metrics usually entails measuring code complexities, lines of code (LOC) or kilo line of codes (KLOC), cyclomatic complexity, coding styles/rules violation and other constraints. These can give great insight into the software applications being developed. Code metrics are usually generated with the use of code analysis tools.

NDepend

NDepend is a code quality analysis tool that when installed integrates into Microsoft Visual Studio and can be used to generate code metrics for projects in a solution and it gives meaningful and detailed reports in a well formatted way with charts and graph. NDepend can be downloaded at http://www.ndepend.com/.

Generating code metrics for projects in a solution is by attaching NDepend to the solution. After the installation of NDepend, a new menu is added to Visual Studio’s menus as shown in the screen below



Attaching NDepend to an existing project brings out a dialog box like the one shown below, indicating all the projects in the concerned solution. Assemblies can also be added by dragging and dropping from windows explorer to the NDepend dialog box to analyze after which the analyze button is clicked.



NDepend will run the analysis and save the result of the analysis in an NDependOut folder that would be created in the solution folder of the project after which a dialog box would be displayed as shown below, the results of the analysis can be viewed from the NDepend's Dashboard.



On the dashboard, the code metrics analysis generated for the solution can be viewed containing detailed reports with information such as the lines of codes, code rules violated, method complexities and so on. Viewing the metrics report is not limited to the dashboard on visual studio alone, the reports can also be viewed from the browser.



Treemap metric view is also available from the NDepend dashboard



Cyclomatic code complexity analysis can give an insight on how complex a project is, NDepend thrives well in this by giving detailed analysis of cyclomatic complexity of classes and the methods cotained like the one shown in screen below.



NDepend gives detailed metrics reports of projects in a solution. It is a productivity tool I have come to fancy overtime.




Share this page on


  0 People Like(s) This Page   Permalink  

 Click  To Like This Page

comments powered by Disqus

page