FxCop 的奇怪警告计数行为?

发布于 2024-07-12 12:15:29 字数 517 浏览 4 评论 0原文

我的团队正在使用 FxCop 来帮助清理现有的 ASP.NET 应用程序。

我们注意到 FxCop 计算警告的方式存在一些奇怪的行为。

似乎在一次通过代码时,FxCop 只查找并计算与每个方法中的特定规则相关的第一个警告。

因此,如果我有:

public test3(){
   int a = 0; //DoNotInitializeUnecessarily
   int b = 0; //DoNotInitializeUnecessarily
}

...我的 FxCop 报告将仅在方法 test3() 中查找并计数 DoNotInitializeUnecessarily 类型的第一个警告。 有什么方法可以让 FxCop 在方法 test3() 中找到并计算此问题的两个实例吗?

当前的计数方法对我们来说是有问题的,因为 FxCop 报告的警告数量较少。 这使得很难估计修复现有 FxCop 警告需要多少时间,因为我们实际上不知道应用程序中有多少个警告。

My team is using FxCop to help clean up an existing ASP.NET application.

We have noticed some strange behavior in the way FxCop counts warnings.

It seems that on one pass through the code, FxCop only finds and counts the first warning related to a specific rule in each method.

So, if I have:

public test3(){
   int a = 0; //DoNotInitializeUnecessarily
   int b = 0; //DoNotInitializeUnecessarily
}

...my FxCop report will only find and count the first warning of type DoNotInitializeUnecessarily in method test3(). Is there any way to make FxCop find and count both instances of this problem in method test3()?

The current method of counting is problematic for us, because FxCop is under reporting the number of warnings. This makes it difficult to estimate how much time will be required to fix existing FxCop warnings, since we don't actually know how many are in the application.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何必那么矫情 2024-07-19 12:15:29

你尝试过改变吗
工具 -> 设置 -> 项目默认值 ->“在 [1] 异常后禁用规则”

Did you try changing
Tools->Settings->Project Defaults->"Disable rules after [ 1] exceptions"
?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文