Is it possible to compose requests in CQL ?
I would like to write something like:
SELECT TYPES FROM ASSEMBLIES "myassemblie" WHERE IsUsing SELECT METHODS FROM ASSEMBLIES "myotherassemblie" WHERE IsStatic
Thanks, Vans
The NDepend team is proud to finally provides an elegant answer to this question :) Thanks to the new NDepend v4 Code Query LINQ (CQLinq) feature, what you are asking for can be written for example like:
let staticMethods = Application.Assemblies.WithName("nunit.core")
.ChildMethods().Where(m => m.IsStatic)
from t in Application.Assemblies.WithName("nunit.util")
.ChildTypes().UsingAny(staticMethods )
let staticMethodsUsed = staticMethods.UsedBy(t)
select new { t, staticMethodsUsed }
There are many other ways to write such query, but this way is certainly the most concise and optimized one (the top-right panel tells it is executed in 4ms):