Questions tagged [cqlinq]

CQLinq is a LINQ-like query language used by NDepend to reflectively analyze .NET source code using the NDepend tool.

CQLinq is a LINQ-like query language used by NDepend to reflectively analyze .NET source code using the NDepend tool.

References

52 questions
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
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

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
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
2
votes
3 answers

How can we detect all pointer comparisons in source code? c++

We want to find all pointer comparisons from a class type. For example we have a class A and derived classes from A like B, C ect. A *pa; A *pa2; B *pb; All comparisons like if (pa == pa2) or if (pa != pb) must be found in our source code. I know…
2
votes
1 answer

Exposing CQL Result in NDepend

I have some custom CQLs in NDepend Project and I want generate the results of these CQLs using NDepend.Console.exe. When I generate the report, I don't see any result of my custom CQLs in the report. I can export from Visual NDepend but I want to…
Ant
  • 3,369
  • 5
  • 25
  • 23
2
votes
1 answer

Finding Types that implement specific Methods using CQL

I'm refining the built in dead code query in NDEpend and I'm finding a lot of false positives from standalone programs (i.e. w/ Main() entrypoints). I noticed that the built in unused types query has this clause: !NameIs "Program" AND //…
Yostage
  • 292
  • 2
  • 4
  • 12
2
votes
1 answer

How to use CQLinq to get metrics of Methods and Fields within a single query

I am calculating average length of identifiers with CQLinq in NDepend, and I want to get the length of the names of classes, fields and methods. I walked through this page of CQlinq: http://www.ndepend.com/docs/cqlinq-syntax, and I have code…
VincentZHANG
  • 757
  • 1
  • 13
  • 31
2
votes
1 answer

Can CQLinq code be reused in multiple queries?

Let's say I'm analyzing a solution which contains a lot of Controls, e.g. public class FooControl : IControlBase { public void EvilMethod1() { // does some warning-level evil here } public void EvilMethod2() { //…
2v0mjdrl
  • 582
  • 4
  • 19
2
votes
0 answers

Query when a type is created with CQLinq

Let's say i have the follwoing code: public abstract class MyBase { } public class MyImplementation : MyBase { } public class MyService1 { MyImplementation myi = new MyImplementation(); } public class MyService2 { public void Foo() { …
gsharp
  • 27,557
  • 22
  • 88
  • 134
2
votes
1 answer

How to get list of extension methods in a solution or project in VS2013?

How does one get the list of extension methods in a solution/project? Is there anything in VS 2013 by default to achieve that like class view or using ndepend cqlinq?
jimjim
  • 2,414
  • 2
  • 26
  • 46
2
votes
1 answer

How to subtract or take complement of an intersection in NDepend?

A custom rule has to be created in NDepend to check the availability of a particular method (e.g. Dispose) in some classes. A warning has to be given for classes that do not contain the method. The following code gives all the classes that need to…
Abdul Rauf
  • 5,798
  • 5
  • 50
  • 70
2
votes
0 answers

how to check whether a function contains try and catch using NDepend?

Need to create a custom rule in NDepend using CQLinq to check whether a public method code block is inside try and catch. The following gives all the public methods: from m in Application.Methods where m.IsPublic select m Is there a feature in…
Abdul Rauf
  • 5,798
  • 5
  • 50
  • 70
2
votes
1 answer

NDepend - how to run a report on number of methods having and not having an attribute

I would like to run a report on how many methods in a particular assembly and its sub-assemblies have and do not have certain attribute. Can you write to me a sample code for this? What are the reporting options? I need to run this report every…
Alpha01
  • 838
  • 6
  • 13
1
vote
1 answer

NDepend rule for "Dispose objects before losing scope"

I'm evaluating NDepend as a part of an effort to enforce code quality and correct framework usage, and I am looking for a way to write the equivalent of CA2000: Dispose objects before losing scope. Anyone else has tried to do this, or has knowledge…