FxCop/StyleCop 是否可以限制为仅分析 Visual Studio 中选定的方法?
我正在组建一个维护团队,并希望引入 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我猜它不能(似乎是一个过于具体的需求)。
I would guess that it can't (seems a too-specific need).
为 FXCop 创建新规则是可能的,但“高级”。 将 FXCop 配置为仅使用可用规则中的某些规则非常简单。
Creating new rules for FXCop is possible, but "advanced". Configuring FXCop to only use certain rules from those available is trivial.
尝试本文中的方法
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
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.
我使用 FxCopCmd.exe (FxCop 1.36) 作为具有各种命令行参数的外部工具,包括以下参数:
I am using FxCopCmd.exe (FxCop 1.36) as an external tool with various command line parameters, including this one: