[英]Visual Studio 2010 code analysis warning CA1704 for class named MultiString
I'm having troubles with the code analysis tool in Visual Studio 2010; 我在Visual Studio 2010中遇到了代码分析工具的麻烦; I have a class used to manipulate multi-strings, therfore I named my class
MultiString
. 我有一个用于操作多字符串的类,因此我将我的类命名为
MultiString
。 When I run the code analysis tool I get the warning: 当我运行代码分析工具时,我收到警告:
CA1704 : Microsoft.Naming : Correct the spelling of 'Multi' in type name 'MultiString'.
CA1704:Microsoft.Naming:在类型名称“MultiString”中更正“Multi”的拼写。
The same problem arises when is use the term multiString
as paramter name or IsMultiApplicationCard
as property name. 当使用术语
multiString
作为参数名称或IsMultiApplicationCard
作为属性名称时,会出现同样的问题。
Thanks to the topic Code Analysis - CA1704: Correct the spelling of 'Ps' I found out that the term multi is unrecognized by default. 感谢主题代码分析 - CA1704:纠正'Ps'的拼写我发现默认情况下无法识别术语multi 。 Now I wonder why (I'm not a native speaker).
现在我想知道为什么(我不是母语人士)。 Isn't multi a valid word?
多字不是一个有效的词吗? What word should I use instead?
我应该用什么词呢? Or would you suggest to use Multiapplication and Multistring ?
或者你会建议使用Multiapplication和Multistring吗?
MultiString
is parsed by Code Analysis into multi, string
, which are then both checked against the dictionaries. MultiString
由Code Analysis解析为multi, string
,然后根据字典进行检查。 Multi
is a valid prefix for a word, but not a word by itself, ie multicolored
is one word, so it should not be written multi colored
. Multi
是单词的有效前缀,但不是单词本身的单词,即multicolored
是一个单词,因此它不应该是multi colored
。 For this reason, the standard dictionary supplied by Microsoft in C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Team Tools\\Static Analysis Tools\\FxCop\\CustomDictionary.xml
explicitly specifies multi
as unrecognised; 因此,Microsoft在
C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Team Tools\\Static Analysis Tools\\FxCop\\CustomDictionary.xml
提供的标准字典明确指定multi
为无法识别; that in turn means that adding Multi
to a custom dictionary is ineffective: Code Analysis will still reject it — but not explain why your dictionary entry is ineffective! 这反过来意味着将
Multi
添加到自定义词典是无效的:代码分析仍然会拒绝它 - 但不解释为什么你的词典条目无效!
You best option seems to be to use Multistring
(as you have noted yourself); 你最好的选择似乎是使用
Multistring
(你已经注意到了); second best would be to suppress CA1704 for this particular case; 第二好的是针对这种特殊情况抑制CA1704; an administrator could presumably edit the standard dictionary, but that would need repeating after any updates, and seems a pretty dirty trick.
管理员可能会编辑标准字典,但在任何更新后需要重复,这似乎是一个非常脏的技巧。
See http://msdn.microsoft.com/en-us/library/bb264492.aspx?ppud=4 for details on how to fix this "violation". 有关如何解决此“违规”的详细信息,请参阅http://msdn.microsoft.com/en-us/library/bb264492.aspx?ppud=4 。 'Multi' is not in the microsoft dictionary.
'Multi'不在微软词典中。 You can change it to, say, 'Multiple'...or you can add 'Multi' to a custom dictionary.
您可以将其更改为“多个”...或者您可以将“多个”添加到自定义词典中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.