Questions tagged [ndepend]

NDepend is a static analysis tool for .NET managed code that focuses on code dependencies and quality.

NDepend is a static analysis tool for .NET managed code that provides extensive code metrics and dependency visualization using directed graphs and a dependency matrix. It also validates code architecture, design, and quality rules, integrates test-coverage analysis, and enables trend monitoring through codebase snapshot comparisons.

NDepend comes with many predefined code rules that users can supplement with custom rules written in Code Query Language (CQL). CQL is very similar to SQL, making codebase queries much like querying a relational database. The tool can also automatically check code rules during continuous integration.

References:

286 questions
3
votes
1 answer

Why does NDepend count Static fields as LOC for a method

I have a type to define and assign some static readonly fields. I got a violation for Methods too big (LOC) I would like to know if I have an attribute for method, and used it in the rule (see below). Where is in my source code I need to use this…
3
votes
1 answer

How do you display the relationships that connect ClassA to ClassX using NDepend?

BACKGROUND When driving through an unknown city, it is often preferable to have a map that can help guide you to your destination. Similarly, when looking at legacy code for the first time it is often preferable to have a diagram that can outline…
Pressacco
  • 2,815
  • 2
  • 26
  • 45
3
votes
1 answer

Ndepend find actual number of method usages

Let's say I have method A.M1. It is called in B.M2 2 times and in B.M3 3 times. I need to find all number of usages (like Resharper does through find usages interface). So the sum for method calls would be 5. Following Query: from m in Methods…
Sasha Reminnyi
  • 3,442
  • 2
  • 23
  • 27
3
votes
1 answer

Evaluation issue with NDepend in CruiseControl.NET

I am trying to integrate NDepend with CruiseControl.NET. However, I get the following build error when I try to build any project: "ERROR: Evaluation issue: Your evaluation period hasn't been activated yet. Please run Visual NDepend to start…
user1409747
  • 91
  • 1
  • 8
3
votes
1 answer

Finding "Dead" assemblies with NDepend

I am in the process of evaluating the NDepend tool for a client of mine, and was wondering if anyone could provide assistance with the following query: // Potentially dead Assemblies warnif count > 0 from a in JustMyCode.Assemblies…
Martin Noreke
  • 4,066
  • 22
  • 34
3
votes
1 answer

How do I import a coverage report from dotcover to ndepend using teamcity?

We use teamcity for Builds Code coverage (using the built in dotCover) Code analysis (using NDepend) This works great separately. But I cant figure out a slick way to get the coverage report in ndepend format and the using it as input to…
Jon
  • 561
  • 4
  • 14
2
votes
2 answers

Does it make sense to make the unit test class static?

I've been using NDepend on my codebase and while my actual code seems to pass with flying colors, my unit test code could use a lot of work. One of the suggestions NDepend made was converting many of my unit test classes into static classes due to…
Peter Smith
  • 849
  • 2
  • 11
  • 28
2
votes
1 answer

Trying to find all methods that don't have a direct dependency on Microsoft.SharePoint.* or System.Web.UI.*

I'm trying to write a CQL query in Visual NDepend to find all types and methods that don't directly depend on any type from a list of namespaces. The Query I've built so far is this one: SELECT METHODS WHERE !IsDirectlyUsing…
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
2
votes
1 answer

NDepend: how to limit JustMyCode to the methods used by x?

The official documentation explains how to limit JustMyCode by exclusion using notmycode notmycode from m in Methods where m.SourceFileDeclAvailable && m.SourceDecls.First().SourceFile.FileName.ToLower().EndsWith(".designer.cs") select m I'd…
Revious
  • 7,816
  • 31
  • 98
  • 147
2
votes
1 answer

How to group in CQLinq?

I have an autogenerated interface and implementation which define 3000+ methods and for each one the respective asynchronous signature. All in all 6,000+ methods. I would like to figure out which ones are NOT used. Here is the CQLinq I have so…
mark
  • 59,016
  • 79
  • 296
  • 580
2
votes
1 answer

Find code using [Obsolete] marked code of a list of assemblies using NDepend

I am currently trying to use NDepend to identify (our) code that uses [Obsolete] marked members of a particular group of referenced assemblies (in my example starting with "Microsoft.TeamFoundation.*") and by "our code" I mean members of ours…
Jörg Battermann
  • 4,044
  • 5
  • 42
  • 79
2
votes
2 answers

Can NDepend detect where string interpolation is used in C#?

I'd like to enforce a rule that log statements do not use string interpolation: Example Log($"Added {count} messages."); Instead I want to encourage/force developers to use structured logging, which means passing values in as separate arguments to a…
ssmith
  • 8,092
  • 6
  • 52
  • 93
2
votes
1 answer

Is it possible with nDepend and CQL today to ask for classes directly using classes of a derived type?

Been reading through a lot of Q's and posts and see that subqueries/nested queries/query composition will not be supported until the next version. However I'm not sure if that is what I need, in my head it I would write it that way but I might be…
JMag
  • 41
  • 3
2
votes
1 answer

Don't assign a field from many methods

I have a class that has a field that is being assigned a value from multiple methods. public class Shape { private Point2D m_location; public void Move() { m_location = ... } public void Rotate() { m_location…
Vahid
  • 5,144
  • 13
  • 70
  • 146
2
votes
0 answers

Number of occurrences of a method NDepend

I need to write an NDepend rule that checks if every await of an Async Method uses ConfigureAwait(false). I check if a method uses ConfigureAwait(Boolean). If that method doesn't use it, it has violated the rule. from m in JustMyCode.Methods…
klemkoek
  • 39
  • 4