Visual Studio 代码分析与 StyleCop + 福克斯警察
我之前在 Visual Studio 项目中使用过 StyleCop + FxCop。 但现在我正在测试Visual Studio代码分析工具,它更容易集成到MSBuild中,并且我发现该工具分析了FxCop和StyleCop的一些规则。
这个工具是 FxCop 和 StyleCop 的完全替代品还是只是实现了它们的一些规则?
I used previously StyleCop + FxCop on my Visual Studio's projects. But now I am testing Visual Studio Code Analysis tool, which is easier to integrate into MSBuild, and I have found that this tools analyses some of the rules of both FxCop and StyleCop.
Is this tool a full replacement for both FxCop and StyleCop or does it just implement some of their rules?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Visual Studio 包括 FxCop 等。
来自 FxCop 开发者博客:
开发人员博客 还给出了每个中的确切规则。
至于 StyleCop,它独立于 VS Code Analysis,如 这篇博文,链接到 Jader迪亚斯的帖子。
Visual Studio includes FxCop + more.
From the developer blog of FxCop:
A developer blog also gave the exact rules which are in each.
As for StyleCop, it's independent of VS Code Analysis as described in this blog post, which links to Jader Dias' post.
我的理解是 Visual Studio Code Analysis 基本上是 FxCop 的稍微修改版本。 根据我的经验,它们几乎是同一件事(事实上,我相信代码分析在幕后使用 FxCop 可执行文件)。
尽管 FxCop/CodeAnalysis 和 StyleCop 之间存在重叠; FxCop 倾向于更多地关注设计规则,而 StyleCop 则关注编码风格(大小写、空格、缩进等)。
FxCop 还分析 IL,而 StyleCop 直接分析源代码。 这对他们各自可以执行的规则施加了一组不同的限制。
My understanding is that Visual Studio Code Analysis is basically a slightly modified version of FxCop. From my experience they are almost the same thing (in fact I believe Code Analysis uses the FxCop executable behind the scenes).
Although there is overlap between FxCop/CodeAnalysis and StyleCop; FxCop tends to focus more on design rules and StyleCop is focusing on coding style (casing, white space, indents, etc).
Also FxCop analyzes the IL while StyleCop analyzes the source code directly. This imposes a different set of restrictions on what rules they can each enforce.
到目前为止,我的谷歌搜索得到了以下答案:
http ://blogs.msdn.com/bharry/archive/2008/07/19/clearing-up-confusion.aspx
指出:
“我们发现 StyleCop 事实上是一个非常有用的工具,它可以做一些事情FxCop 和 TeamDev 不做(而且它不做他们做的事情),StyleCop 是一个很好的补充工具,用于进行编码风格检查,以验证源代码是否按照您想要的方式格式化并遵循您的要求。虽然与 FxCop 存在一些重叠(例如检查标识符大写),但重叠很小,因为 StyleCop 不会像其他静态分析工具那样进行深入分析来启用代码正确性检查、安全检查等。
但我不确定“TeamDev”是否与“Visual Studio 的代码分析”相同
Until now my googling resulted in the following answer:
http://blogs.msdn.com/bharry/archive/2008/07/19/clearing-up-confusion.aspx
states:
"We found that StyleCop is, in fact, a very useful tool and it does things FxCop and TeamDev doesn't do (and it doesn't do the things they do). It is a wonderful complementary tool. StyleCop is a tool for doing coding style checking to verify that source code is formatted the way you want and follows the style guidelines for conventions. While there is some overlap with FxCop (like checking identifier capitalization), the overlap is miniscule as StyleCop does not do the deep analysis that the other static analysis tools do to enable code correctness checks, security checks, etc."
But I'm not sure if the "TeamDev" is the same thing as "Visual Studio's Code Analysis"