NDepend

NDepend
Developer(s) NDepend
Stable release
6.3.0.8686 / April 29, 2016 (2016-04-29)
Operating system Windows
Type Software quality
License Commercial, Proprietary
Website ndepend.com

NDepend is a static analysis tool for .NET managed code. This tool supports a large number of code metrics, allows for visualization of dependencies using directed graphs and dependency matrix. The tools also performs code base snapshots comparison, and validation of architectural and quality rules. User-defined rules can be written using LINQ queries. This possibility is named CQLinq. The tool also comes with a large number of predefined CQLinq code rules. Code rules can be checked automatically in Visual Studio or during continuous integration.

Features

The main features of NDepend are:

New features since V6.0

Code rules through LINQ queries (CQLinq)

CQLinq editor and query result displayed

Since NDepend version 4 released in May 2012, the tool proposes live code queries and code rules through LINQ queries. This is one of the innovations of NDepend. For example:

- Base class should not use derivatives:

// <Name>Base class should not use derivatives</Name>
warnif count > 0 
from baseClass in JustMyCode.Types
where baseClass.IsClass && baseClass.NbChildren > 0 // <-- for optimization!
let derivedClassesUsed = baseClass.DerivedTypes.UsedBy(baseClass)
where derivedClassesUsed.Count() > 0
select new { baseClass, derivedClassesUsed }

- Avoid making complex methods even more complex (source code cyclomatic complexity):

// <Name>Avoid making complex methods even more complex (source code cyclomatic complexity)</Name>
warnif count > 0 
from m in JustMyCode.Methods where
 !m.IsAbstract &&
  m.IsPresentInBothBuilds() &&
  m.CodeWasChanged()
let oldCC = m.OlderVersion().CyclomaticComplexity
where oldCC > 6 && m.CyclomaticComplexity > oldCC 
select new { m,
    oldCC, 
    newCC = m.CyclomaticComplexity, 
    oldLoc = m.OlderVersion().NbLinesOfCode,
    newLoc = m.NbLinesOfCode,
}

In addition, the tool proposes a live CQLinq query editor with code completion and embedded documentation.

See also

NDepend reviewed by the .NET community

Books that mention NDepend

This article is issued from Wikipedia - version of the 9/6/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.