FxCop/StyleCop 是否可以限制为仅分析 Visual Studio 中选定的方法?

发布于 2024-07-04 18:56:42 字数 242 浏览 4 评论 0原文

我正在组建一个维护团队,并希望引入 FxCop 和 StyleCop 等工具来帮助改进代码并向开发人员介绍更好的编程技术和标准。 由于我们正在维护代码并且没有进行重大增强,因此在进行更改时我们可能只会一次处理几个方法/例程。

是否可以将 FxCop/StyleCop 定位到 Visual Studio 中的特定代码区域,以避免在分析整个类或项目时遇到所有可能出现的问题? 如果可以的话,你会怎样做呢?

谢谢, 马特

I am taking on a maintenance team and would like to introduce tools like FxCop and StyleCop to help improve the code and introduce the developers to better programming techniques and standards. Since we are maintaining code and not making significant enhancements, we will probably only deal with a couple of methods/routines at a time when making changes.

Is it possible to target FxCop/StyleCop to specific areas of code within Visual Studio to avoid getting overwhelmed with all of the issues that would get raised when analyzing a whole class or project? If it is possible, how do you go about it?

Thanks,
Matt

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

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

发布评论

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

评论(5

死开点丶别碍眼 2024-07-11 18:56:42

我猜它不能(似乎是一个过于具体的需求)。

I would guess that it can't (seems a too-specific need).

生生漫 2024-07-11 18:56:42

为 FXCop 创建新规则是可能的,但“高级”。 将 FXCop 配置为仅使用可用规则中的某些规则非常简单。

Creating new rules for FXCop is possible, but "advanced". Configuring FXCop to only use certain rules from those available is trivial.

旧伤慢歌 2024-07-11 18:56:42

尝试本文中的方法

http://blogs.msdn.com/sourceanalysis/archive/2008/11/11/introducing-stylecop-on-legacy-projects.aspx

您可以通过添加要包含或的属性,从 StyleCop 的珠眼中删除单个文件排除 .csproj 中的每个文件

Try the approach in this article

http://blogs.msdn.com/sourceanalysis/archive/2008/11/11/introducing-stylecop-on-legacy-projects.aspx

You can remove individual files from StyleCop's beady eye by adding properties to include or exclude each file in the .csproj

终止放荡 2024-07-11 18:56:42

FxCop 可以使用命令行或 GUI 来定位特定类型。 StyleCop 不提供这样的机制。

但是,对于它们两者,您可以针对特定规则而不是类型,这可能会更好地将“噪音”量减少到更易于管理的块。

FxCop can target specific types using either the command line or the GUI. StyleCop does not provide such a mechanism.

However, for both of them you can target specific rules instead types which may work better to reduce the amount of "noise" to more manageable chunks.

可可 2024-07-11 18:56:42

我使用 FxCopCmd.exe (FxCop 1.36) 作为具有各种命令行参数的外部工具,包括以下参数:

/types:<type list>  [Short form: /t:<type list>]
Analyze only these types and members.

I am using FxCopCmd.exe (FxCop 1.36) as an external tool with various command line parameters, including this one:

/types:<type list>  [Short form: /t:<type list>]
Analyze only these types and members.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文