NDepend is a static analysis tool for .NET managed code. The tool supports a large number of code metrics, including smart technical debt estimations produced by a powerful rules engine to check the code base against best software practices. User-defined rules can be written using C# LINQ queries against the code. More than 150 predefined code rules are proposed. Code rules can be checked automatically in Visual Studio or during continuous integration. NDepend also comes with dependency graphs and dependency matrix to explore the code structure. The tool also performs code base snapshots comparison and this way, all results can be checked against a baseline.
Important notice before you start
No data goes outside of your server because The NDepend extension does not use an endpoint to do the analysis. The NDepend tool is embedded in the extension and all the results are stored as a build artifacts in your server.
Before adding the NDepend task into your build definition, you have to activate first the NDepend license from the NDepend dashboard.
Please refer to this documentation to configure the NDepend extension.
The NDepend DevOps extension consists of a build task that analyses code and code coverage data yielded by the build process. The NDepend DevOps hub presents the results which embed the NDepend dashboard and makes data actionable by drilling down into any item through a single click.
The hub's Dashboard shows a recap of the most relevant data including technical debt estimations, code size, Quality Gates status, rules and issues numbers. A TFS build can be used as a baseline. All dashboard data is then diff-ed since the baseline. Each Dashboard item is clickable to view more.
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. For example a Quality gate can be written to enforce a certain amount of code coverage by tests ratio on code added and refactored since the baseline. A detailed summary of Quality Gates status is available.
More than 150 default code rules are proposed to check against best practices. Support for Code Query over LINQ (CQLinq) to easily write custom rules and query code. CQLinq is used both to write the rule code, and also to write smart C# formulas that estimate the Technical-Debt for each issue (i.e the cost-to-fix an issue).
Rules details can be explored. Clicking a rule violation redirects the user to the DevOps Azure Code Search extension, displaying the source code of the culprit code element.
Technical Debt and Issues
Technical debt can be drilled down till the issue level. Clicking an issue results in editing it in the Rules panel. The datagrid is interactive: issues can be grouped, ordered and filtered by rule names, by code elements, by severity or by their status since the baseline (new / exist / fixed).
Issues can be also sorted by estimated Technical-Debt metrics, including issues fix prioritization. Typically severe issues that cost little to be fixed should be fixed first and are prioritized.
The DevOps Azure extension logs Trend Metrics for each build, and Trend charts are shown. More than 70 predefined Trend Metrics are proposed and CQLinq lets write custom ones.
A panel shows a code metrics recap for each assembly, namespace, class or method. Code metrics include Lines of Code ; Cylomatic Complexity ; Technical Debt (estimated cost to fix code elements issues) ; Code Coverage ratio ; Comment ratio ; # user / # used... The datagrid is interactive: elements can be grouped, ordered and filtered by name and they can also be sorted by metric value.
Build Summary Recap
An NDepend Analysis recap is shown in each Build Summary:
For support, please write an email to email@example.com.