cqlinq

NDepend -Finding dead methods

自作多情 提交于 2020-01-03 17:42:08
问题 I have two public methods A & B. I modified CQL to show me methods which are public and dead. If B is only called by A and A is coming as dead method(not called or referenced anywhere in the application) can NDepend show both the methods as dead by doing some settings or by CQL? In current scenario I am getting only A as dead method not B. 回答1: can NDepend show both the methods as dead by doing some settings or by CQL? Yes, NDepend can do that thanks to Code Rule over LINQ Query (CQLinq)

Find all uses of a method (including via interface) using NDepend

廉价感情. 提交于 2019-12-22 05:01:01
问题 Using NDepend, how can I find all, direct and indirect, uses of a specific method or property? In particular, I need to find usages that occur via an interface somewhere along the use path. Thanks! 回答1: Right clicking a method anywhere in the UI, and selecting the menu: Select Method... > ...that are using me (directly or indirectly) leads to a code query like: from m in Methods let depth0 = m.DepthOfIsUsing("NUnit.Core.NUnitFramework+Assert.GetAssertCount()") where depth0 >= 0 orderby depth0

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

穿精又带淫゛_ 提交于 2019-12-13 02:02:16
问题 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? 回答1: You can just write the code query: from m in Application.Methods where m.IsExtensionMethod select m For a code query that group extension method sby types extended see: Getting list of types that are effected by an extension method in cqlinq 来源: https://stackoverflow.com/questions/29481538/how-to-get-list-of-extension

CQLINQ for list of methods returning a specific type or interface?

不问归期 提交于 2019-12-11 09:01:41
问题 What is the CQLINQ to get list of methods returning a (compatible) specific type or interface? 回答1: You can get inspiration from such query: let listOfT = ThirdParty.Types.WithFullName( "System.Collections.Generic.IList<T>").Single() let compatibleTypes = listOfT.TypesThatImplementMe.Concat(listOfT) from m in Methods.Where(m => m.ReturnType != null && compatibleTypes.Contains(m.ReturnType)) select new { m, m.ReturnType } 来源: https://stackoverflow.com/questions/29505525/cqlinq-for-list-of

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

社会主义新天地 提交于 2019-12-10 22:30:56
问题 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 like: let id_m = Methods.Select(m => new { m.SimpleName, m.SimpleName.Length }) let id_f = Fields.Select(f => new { f.Name, f.Name.Length }) select id_m.Union(id_f) It doesn't work, one error says: 'System.Collections.Generic.IEnumerable' does not contain