更正 StyleCop 中的拼写规则

发布于 2024-11-25 13:22:25 字数 160 浏览 3 评论 0原文

StyleCop 规则 SA1642 坚持要求我的构造函数文档头必须以“初始化...的新实例”开头。

虽然我同意规则本身,但我就是无法接受 StyleCop 强制执行我认为丑陋的拼写。它是用“s”来“初始化”的!!!

是否可以修改预期的文本,或者我必须简单地禁用合理的规则?

StyleCop rule SA1642 insists that my documentation header for constructors must begin with 'Initializes a new instance of...'.

Whereas I agree with the rule itself, I just can't bring myself to accept StyleCop enforcing spellings I consider ugly. It's 'initialises' with an 's'!!!

Is it possible to modify the expected text, or must I simply disable a sensible rule?

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

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

发布评论

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

评论(2

时光病人 2024-12-02 13:22:25

在最新的 stylecop 设置中,您可以在选项选项卡中将“分析文化”设置为 en-GB,它将使用英式拼写而不是美式拼写。

In the latest stylecop settings you can set the "Culture for analysis" to en-GB in the options tab and it will use British spelling instead of American.

梦里梦着梦中梦 2024-12-02 13:22:25

当前StyleCop版本不支持文档规则的自定义。并且没有短期计划来支持它。

作为一种可能的解决方法(而不是禁用整个规则),您可以参考一些第三方自定义规则。例如,StyleCop+ 目前允许编写“初始化一个新实例。” 以及 < em>“初始化 Class1 类的新实例。”

所以我猜它可以扩展为也允许“初始化...”。但如果你想强制“初始化”并禁止“初始化”,似乎你需要等待可定制的文档规则支持。

Current StyleCop version doesn't support customization for documentation rules. And there are no short-term plans to support it.

As a possible workaround (instead of disabling the entire rule) you could refer to some third-party custom rules. For example, StyleCop+ currently allows writing "Initializes a new instance." as well as "Initializes a new instance of the Class1 class."

So I guess it could be extended to also allow "Initialises ...". But if you want to force "Initialises" and prohibit "Initializes" it seems you need to wait for customizable documentation rules support.

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