如何让 FxCop 规则 CA1726 忽略首选术语?

发布于 2024-07-13 07:51:36 字数 327 浏览 5 评论 0原文

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 技术交流群。

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

发布评论

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

评论(1

酒废 2024-07-20 07:51:36

我已经回答了我自己的问题。

事实证明,首选术语列表列在 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.

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