如何让 FxCop 规则 CA1726 忽略首选术语?
FxCop 有一个规则 (CA1726) 用于检查首选术语。 它会查找“Dont”等单词,并告诉您将其替换为“Do not”等更好的单词。 一般来说,这很好,但是它反对的术语之一是“标志”。 在我们公司,业务涉及旗帜,即旗杆末端的那些布料。 每次压制这条规则都变得很痛苦。 有谁知道如何让此规则适用于除“Flag”之外的所有内容?
注意:我知道我可以完全关闭该规则,但我不想这样做。 我只是想关闭部分规则。
FxCop has a rule (CA1726) that checks for preferred terms. This looks for words like "Dont" and tells you to replace them with better words like "Do not". Generally this is fine, however one of the terms it objects to is "Flag". At our firm, the business deals with Flags meaning those cloth things at the end of flagpoles. Suppressing this rule each time is becoming a pain. Does anyone know a way to get this rule to work on everything except "Flag"?
Note: I know I can turn the rule off completly, but I don't want to do that. I just want to turn off part of the rule.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经回答了我自己的问题。
事实证明,首选术语列表列在 FxCop 安装目录 (C:\Program Files\Microsoft FxCop 1.36\CustomDictionary.xml) 中的 CustomDictionary.xml 文件中。 有一个部分包含许多元素。 只需删除我不想要的那些就可以了。
I have answered my own question.
It turns out that the list of preferred terms is listed in the CustomDictionary.xml file that is in the FxCop install directory (C:\Program Files\Microsoft FxCop 1.36\CustomDictionary.xml). There is a section <Dictionary><Words><Deprecated> that contains a number of <Term> elements. Simply removing the ones I don't want has done the trick.