更正 StyleCop 中的拼写规则
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在最新的 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.
当前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.