开发者

Using CustomDictionary.xml in Visual Studio Code Analysis for fancy-cased identifiers

For example, an identifier like iPhone. When I ran code analysis, it gave me this error:

CA1709 : Microsoft.Naming : Correct the casing of 'i' in namespace name 'iPhone.Example' by changing it to 'I'.

I tried adding an entry to CustomDictionary.xml as follow:

<Words>
    <Recognized>
        <Word>iphone</Word>
    </Recognized>
</Words>

Then it still gave me the same error and one more, as follows:

CA1702 : Microsoft.Naming : The compound word 'iPhone' in namespace name 'iPhone.Example' exists as a discrete term. If your usage is intended to be single word, case it as 'iphone'开发者_Python百科.

I then added some more rules as follows:

<Compound>
    <Term CompoundAlternate="IPhone">iphone</Term>
</Compound>
<DiscreteExceptions>
    <Term>iphone</Term>
</DiscreteExceptions>
<Acronyms>
    <CasingExceptions>
        <Acronym>iPhone</Acronym>
    </CasingExceptions>
</Acronyms>

But it didn't give any difference. Is there anyway to add this kind of exception?

Thanks in advance.


Nothing you add to the dictionary will avoid the original CA1709 violation since the problem has nothing to do with spelling. Instead, it problem lies with the lack of capitalization of the first letter, which violates the Pascal casing convention for namespace names.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜