如何对某些 StyleCop 规则做出例外?

发布于 2024-11-18 16:15:57 字数 537 浏览 6 评论 0原文

可能的重复:
如何抑制 StyleCop 警告?

目前,我正在为我们的项目设置 StyleCop我偶然发现了 StyleCop 的一项规则。这是关于SA1300的命名规则:

SA1300:命名空间名称以 大写字母:iCompanyName。

所以我的公司以小写字母开头。各种产品名称也是如此。因此,是否有可能在 Settings.StyleCop 文件中添加此规则的例外情况?

我想阻止使用 C# 编写自定义 StyleCop 规则。

预先感谢您的回复。

编辑: 我意识到我应该注意到我实际上并不想完全禁用/抑制 StyleCop 规则。我只想对这个命名规则做一些例外。

Possible Duplicate:
How to suppress a StyleCop warning?

Currently I'm setting up StyleCop for our projects and I stumbled on one rule of StyleCop. It's about the SA1300 naming rule:

SA1300: namespace names begin with an
upper-case letter: iCompanyName.

So my company starts with a lower-case letter. And various product names do also. Therefore, is there a possibility to add exceptions to this rule in the Settings.StyleCop file?

I'd like to prevent to write custom StyleCop rules using C#.

Thanks in advance for your replies.

edit:
I realize I should have noted that I don't actually want to disable/suppress the StyleCop rule completely. I'd just like to make some exceptions on this naming rule.

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

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

发布评论

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

评论(2

丢了幸福的猪 2024-11-25 16:15:57

SA1300 规则不可配置(至少在版本 4.4 中)。如果您不喜欢其行为并且不想完全禁用该规则,则需要使用替代自定义规则。您也许可以从第三方找到一个可用的项目,例如 StyleCop+ 项目。如果没有,你就只能自己动手了……

The SA1300 rule is not configurable (at least in version 4.4). If you don't like its behaviour and don't want to disable the rule entirely, you will need to use a substitute custom rule. You might be able to find one available from a third-party such as the StyleCop+ project. If not, you're pretty much stuck rolling your own...

好多鱼好多余 2024-11-25 16:15:57

您可以根据具体情况抑制该消息,如 StyleCop 网站 - http: //stylecop.codeplex.com/wikipage?title=Rule%20Suppressions

另外,看看这个问题 - 如何抑制 StyleCop 警告?

You can suppress the message on a case by case basis as described on the StyleCop site - http://stylecop.codeplex.com/wikipage?title=Rule%20Suppressions

Also, have a look at this question - How to suppress a StyleCop warning?

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