- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
使用 NDepend ,如何找到特定方法或属性的所有直接和间接用途?
特别是,我需要找到使用路径中某处通过接口(interface)发生的用法。谢谢!
最佳答案
右键单击 UI 中任意位置的方法,然后选择菜单:选择方法... > ...正在使用我(直接或间接) 会导致代码查询,如:
from m in Methods
let depth0 = m.DepthOfIsUsing("NUnit.Core.NUnitFramework+Assert.GetAssertCount()")
where depth0 >= 0 orderby depth0
select new { m, depth0 }
问题在于此类查询提供了间接用法,但不会查找通过接口(interface)(或在基类中声明的重写方法)发生的调用。
希望可以通过此查询获得您所要求的内容:
// Retrieve the target method by name
let methodTarget = Methods.WithFullName("NUnit.Core.NUnitFramework+Assert.GetAssertCount()").Single()
// Build a ICodeMetric<IMethod,ushort> representing the depth of indirect
// call of the target method.
let indirectCallDepth =
methodTarget.ToEnumerable()
.FillIterative(
methods => methods.SelectMany(
m => m.MethodsCallingMe.Union(m.OverriddensBase)))
from m in indirectCallDepth.DefinitionDomain
select new { m, callDepth = indirectCallDepth[m] }
这个查询的两个基石是:
关于c# - 使用 NDepend 查找方法的所有使用(包括通过接口(interface)),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11012315/
两者CppDepend和 NDepend由同一家公司开发,似乎基于相同的代码库并共享一些功能。我还没有找到并排比较网站。 我致力于几个完全没有任何 C++ 代码的纯 C# 解决方案,但也有除 C# 之
我有一个类型来定义和分配一些静态只读字段。我收到了“方法太大 (LOC)”的违规 我想知道我是否有方法的属性,并在规则中使用它(见下文)。我的源代码中的哪里需要使用此属性来丢弃“this andwhi
我工作的一个客户已经开始使用 NDepend 作为 FXCop 的替代品,并且“架构师”编制了一份实际上无法使用的 CQL 查询列表,我从 NDepend 网站的建议中收集到这些信息。 “我认为”是无
有谁知道我如何使用 NDepend 中的 CQL 查询在源代码中找到魔数(Magic Number)?这与 this question 是同一个问题, 但我不想尽可能使用正则表达式。 所以我想找到所有
背景 随着时间的推移,我发现自己越来越多地转向NDepend来深入了解遗留应用程序的设计/实现。 问题 有没有办法永久配置NDepend(在项目级别)以简单地忽略 .NET Framework,而不是
我正在为我的客户评估 NDepend 工具,想知道是否有人可以为以下查询提供帮助: // Potentially dead Assemblies warnif count > 0 from a
CQL 可以轻松找到 CodeWasChanged 的方法但我还需要比较指标 - 我想找到修改后的代码,看看它是否有所改进。 我正在评估ndepend和 cppdepend对于混合代码库。两者都给我留
是否可以用 CQL 编写请求? 我想写这样的内容: 从程序集“myassemblie”中选择类型,其中Is使用从程序集“myotherassemblie”中选择方法,其中 IsStatic 谢谢,货车
我有两个公共(public)方法 A 和 B。我修改了 CQL 以向我展示公共(public)和死的方法。 如果 B 仅由 A 调用并且 A 作为死方法出现(未在应用程序中的任何位置调用或引用),ND
假设我有方法 A.M1。它在 B.M2 中调用了 2 次,在 B.M3 中调用了 3 次。我需要找到所有用法(就像 Resharper 通过查找用法界面所做的那样)。因此方法调用的总和为 5。 以下查
我刚刚通过 NDepend 运行我的一个项目,报告将我的程序集置于痛苦区域的角落。我只是想知道这是否是我应该担心的事情。 疼痛区的真正含义是什么?是不是说耦合度很高,事情不是很容易改变的。 我最近删除
我有一个使用一些可移植类库的解决方案,但当程序集是一个可移植类库时,我无法弄清楚如何修复查找要在程序集上定义的某些属性的默认规则。 例如,规则 Mark assemblies with CLSComp
NDepend 似乎是一个很棒的代码分析工具,尤其是依赖图可视化,所以我们买了一份。 但是,我真正最需要的一件事似乎是不可能的:我需要整个解决方案的 namespace 依赖关系图。我唯一能得到的是一
从昨天开始,我正在用 Ndepend 分析我们的一个项目(它的大部分功能都是免费的)更多我正在使用它,更多我怀疑这种软件(代码分析软件)的真正值(value)。 让我解释一下,系统通过对每个指标进行排
我希望能够将在每次构建后与之前构建后对特定方法列表的任何依赖项所做的任何代码更改进行比较的能力集成到我们的构建过程中。 因此,如果我有两个访问数据库的方法,我希望能够判断调用这两个方法中的任何一个的方
通过转到工具->选项并设置哪些程序集将成为分析的一部分(并忽略其余程序集),我能够在早期版本的 nDepend 中执行此操作。 nDepend 试用版的最新版本让我可以设置它,但它似乎忽略了设置并始终
我喜欢 NDepend,如果我能弄清楚如何让它在构建过程中连夜运行报告,我会更喜欢它。 我们正在使用 NDepend v5 和 TFS 2012,但我终其一生都找不到有关如何执行此操作的任何资源。我找
我想查询特定类的公共(public)方法表以及 NDepend CQL 中每个方法的使用计数。当前查询如下所示: SELECT METHODS FROM TYPES "AE.DataAccess.DB
我正在尝试使用 NDepend 及其基于 Linq 的查询语言来生成一些有关代码当前状态的报告。我想用预定义的“标签”标记我的一些方法和类,例如标记为“数据库”的方法包含数据库特定代码,标记为“Alg
当解决方案在 TFS2010 的自动构建中构建时,我试图自动打开 NDepend 项目。 这源于this上一个问题。前面提到的帖子是我尝试(但失败了)通过弄乱我的解决方案的 XML 将 NDepend
我是一名优秀的程序员,十分优秀!