在您的项目中使用 FXCop

发布于 2024-07-24 16:14:23 字数 1433 浏览 5 评论 0原文

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

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

发布评论

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

评论(2

泅人 2024-07-31 16:14:23

请注意,FxCop 可以根据您希望应用的规则进行高度自定义。 您可能会发现通过逐步引入它效果最好; 仅适用于特定文件集的特定规则集,甚至最初排除所有旧文件。

肯定有一些规则您可能永远不会激活,因为它们不适合您的问题域。 请记住,如果一段代码出于特定目的“违反了规则”,则有一个属性可以将此类代码标记为可接受,尽管我会制定一条规则,即所有此类覆盖都必须使用理由属性上的属性来指示原因。

最后,尽管内置规则对提高代码质量有很大帮助,但真正的重大胜利在于自定义规则,它允许您检查公司约定。 如果您不以这种方式自动执行“同行评审”,那么您就无法真正保证合规性。

我在工作中使用 FxCop 作为构建系统的集成部分,我们的公共库目前已发布,并启用了所有规则并启用了最少的属性覆盖,并且它在很多地方都是值得的。

Note that FxCop is very customisable with regards to the rules you wish to apply. You may find it works best by incrementally introducing it; only for a certain set of rules for a certain set of files, or even excluding all legacy files initially.

There are bound to be rules that you may never activate because they just do not suit your problem domain. And remember that if a piece of code 'breaks a rule' for a specific purpose, there is an attribute to mark such code as acceptable, although I would instate a rule that all such overrides must use the Justification property on the attribute to indicate why.

Finally, as much as the built-in rules will help a lot with improving code quality, the really big wins are to be had in custom rules that will allow you to check for company conventions. If you do not automate your 'peer review' in this fashion, then you cannot really guarantee compliance.

I use FxCop as an integrated part of the build system at work, and our common libraries currently get released with all rules enabled with minimal attribute overrides, and it has been worthwhile in more than a few places.

幸福还没到 2024-07-31 16:14:23

我想说真正使用 FxCop 的地方并不多。 我们打开了它,但大多数开发人员忽略了产生的警告。

另外,这里的开发管理部门对真正推动清理警告并不感兴趣,部分原因是 FxCop 真的不喜欢管理层希望我们遵循的约定(变量名称等)......

在我领导的项目中,我强制使用它,因为我认为它可以帮助我们成为更好的程序员。 但你必须处于顶部才能让所有开发人员跟随它。

I'd say there aren't that many places really using FxCop. We have it turned on, but most of the dev staff ignores the warnings produced.

Also, Dev Management here hasn't been interested in really pushing cleaning up the warnings, in part because FxCop really dislikes the conventions (variable names, etc) that management wants us to follow...

On projects where I've been the lead, I've mandated its use because I think it helps us be better programmers. But you have to have by in at the top in order to get all the dev's to follow it.

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