NDepend 2017.2.2.8962 | 17 Mb
NDepend is the only Visual Studio extension that is able to tell the developer that over the past hour, the code just written has introduced debt that would cost for example about 30 minutes should it have to be repaid later. Knowing this, the developer can fix the code before even committing it to the source control.
With NDepend code rules are C# LINQ queries that can be created and customized in a matter of seconds. These queries contain C# formulas to compute accurate technical debt estimations.
The default rule-set offers over a hundred code rules that detect a wide range of code smells including entangled code, dead-code, API breaking changes and bad OOP usage.
Around 200 default queries and rules are provided when you create a new NDepend project. They are easy to read and easy to adapt to your need.
Writing CQLinq queries and constraints is straightforward both because it is C# LINQ syntax and because NDepend provides a CQLinq editor which supports:
code completion / intellisense
live compile error description
integrated tooltip documentation
Compare Builds and Code Diff
In software development, products are constantly evolving. Hence, developers and architects must pay attention to modifications in code bases. Modern source code repositories handle incremental development. They can enumerate differences between 2 versions of source code files.
NDepend can tell you what has been changed between 2 builds but it does more than simple text comparison. It can distinguish between comment change and code change, between what has been added/removed and what has just been modified. With NDepend, you can see how code metrics are evolving and you know if coupling between components is increasing or not. NDepend can also continuously check modifications to warn you as soon as a breaking compatibility change appears.
Harness Test Coverage Data
Writing automatic tests is a central practice to increase code correctness. Knowing which part of the code is covered by automatic tests helps improving tests and consequently, it helps increasing code correctness.
NDepend gathers code coverage data from NCover™ and Visual Studio Team System™. From this data, NDepend infers some metrics on methods, types, namespaces and assemblies : PercentageCoverage, NbLinesOfCodeCovered, NbLinesOfCodeNotCovered and BranchCoverage (from NCover only).
These metrics can be used conjointly with others NDepend features. For example you can know what code have been added or refactored since the last release and is not thoroughly covered by tests. You can write a CQLinq rule to continuously check that a set of classes is 100% covered. You can list which complex methods need more tests.
Smart Technical Debt Estimation
Nowadays, the technical-debt metaphor has been widely adopted by the software industry. It was coined by Ward Cunningham in 1992.
This reference article by Martin Fowler describes the technical-debt metaphor in great detail. To quote M.Fowler:
In this metaphor, doing things the quick and dirty way sets us up with a technical debt, which is similar to a financial debt. Like a financial debt, the technical debt incurs interest payments, which come in the form of the extra effort that we have to do in future development because of the quick and dirty design choice. We can choose to continue paying the interest, or we can pay down the principal by refactoring the quick and dirty design into the better design. Although it costs to pay down the principal, we gain by reduced interest payments in the future.
As from NDepend v2017.1.0, NDepend estimates the technical-debt of a code base. The tool proposes many unique features to handle the technical-debt the right way:
Smart Technical-Debt Estimation: The technical-debt is estimated from C# LINQ formulas embedded inside each rule source code. This makes the the estimations both smart and easily customizable to your needs.
A Quality Gate is a check on a code quality fact that must be enforced before releasing and eventually, before committing to source control. A Quality Gate can be seen as a PASS/FAIL criterion for software quality.
A dozen of default Quality Gates are proposed by NDepend related to measures like technical debt amount, code coverage or amount of issues with particular severity.
In-Depth Issues Management
As a static analyzer, NDepend will likely find hundreds or even thousands of issues affecting a real-world code base. Stopping work to attempt to fix all issues for a few weeks or months would be quite unproductive.
This is why NDepend is the only tool that offers a baseline in Visual Studio. The tool estimates the Technical Debt progress since a baseline.
Recent code smells that should be fixed before committing any code to source control are highlighted in Visual Studio. They can then be fixed even before reaching the source server. As a consequence the Code Quality remains under control with no major upfront investment.
Concretely, for all global numbers (number of issues, numbers of rules violated, debt estimation...) the Dashboard also shows these numbers' differences since baseline. If it is getting worse the number is red, if it is getting better the number is green. The numbers themselves can be clicked to generate C# LINQ queries against the issues-set. The results of these queries will present the relevant issues in a smart and browsable way.
This flexible approach brings several benefits:
You can filter by new issues since baseline.
Issues matched by a query can be grouped through code elements or through rules.
For each issue, the cost-to-fix is estimated and so its impact on the business, which are named debt and annual interest or severity.
Some proposed queries contain heuristics to maximize the issue-fix Return-On-Investment. For example an issue can be relatively easy to fix but still have a high business impact (high severity). This issue should then be fixed first.
Queries on the issue-set can be refined and saved to prioritize which issues to fix first.
With a single click you can jump from the issue to the source code in both Visual Studio and VS Team Services NDepend extensions.