|
1 | 1 | ---
|
2 | 2 | title: "CA1701: Resource string compound words should be cased correctly | Microsoft Docs"
|
3 |
| -ms.custom: "" |
4 |
| -ms.date: "11/04/2016" |
5 |
| -ms.reviewer: "" |
6 |
| -ms.suite: "" |
7 |
| -ms.technology: |
8 |
| - - "vs-ide-code-analysis" |
9 |
| -ms.tgt_pltfrm: "" |
10 |
| -ms.topic: "article" |
11 |
| -f1_keywords: |
| 3 | +ms.date: 03/28/2018 |
| 4 | +ms.technology: vs-ide-code-analysis |
| 5 | +ms.topic: reference |
| 6 | +f1_keywords: |
12 | 7 | - "ResourceStringCompoundWordsShouldBeCasedCorrectly"
|
13 | 8 | - "CA1701"
|
14 |
| -helpviewer_keywords: |
| 9 | +helpviewer_keywords: |
15 | 10 | - "CA1701"
|
16 | 11 | - "ResourceStringCompoundWordsShouldBeCasedCorrectly"
|
17 | 12 | ms.assetid: 4ddbe09f-24b8-4c47-9373-a06f4487ca0d
|
18 |
| -caps.latest.revision: 24 |
19 | 13 | author: "gewarren"
|
20 | 14 | ms.author: "gewarren"
|
21 | 15 | manager: ghogen
|
22 |
| -ms.workload: |
| 16 | +ms.workload: |
23 | 17 | - "multiple"
|
24 | 18 | ---
|
25 | 19 | # CA1701: Resource string compound words should be cased correctly
|
26 |
| -||| |
27 |
| -|-|-| |
28 |
| -|TypeName|ResourceStringCompoundWordsShouldBeCasedCorrectly| |
29 |
| -|CheckId|CA1701| |
30 |
| -|Category|Microsoft.Naming| |
31 |
| -|Breaking Change|Non-breaking| |
32 |
| - |
33 |
| -## Cause |
34 |
| - A resource string contains a compound word that does not appear to be cased correctly. |
35 |
| - |
36 |
| -## Rule Description |
37 |
| - Each word in the resource string is split into tokens that are based on the casing. Each contiguous two-token combination is checked by the Microsoft spelling checker library. If recognized, the word produces a violation of the rule. Examples of compound words that cause a violation are "CheckSum" and "MultiPart", which should be cased as "Checksum" and "Multipart", respectively. Due to previous common usage, several exceptions are built into the rule, and several single words are flagged, such as "Toolbar" and "Filename", that should be cased as two distinct words. In this example, "ToolBar" and "FileName" would be flagged. |
38 |
| - |
39 |
| - Naming conventions provide a common look for libraries that target the common language runtime. This reduces the learning curve that is required for new software libraries, and increases customer confidence that the library was developed by someone who has expertise in developing managed code. |
40 |
| - |
41 |
| -## How to Fix Violations |
42 |
| - Change the word so that it is cased correctly. |
43 |
| - |
44 |
| -## When to Suppress Warnings |
45 |
| - It is safe to suppress a warning from this rule if both parts of the compound word are recognized by the spelling dictionary and the intent is to use two words. |
46 |
| - |
47 |
| - You can also add compound words to a custom dictionary for the spelling checker. Words in the custom dictionary do not cause violations. For more information, see [How to: Customize the Code Analysis Dictionary](../code-quality/how-to-customize-the-code-analysis-dictionary.md). |
48 |
| - |
49 |
| -## Related Rules |
50 |
| - [CA1702: Compound words should be cased correctly](../code-quality/ca1702-compound-words-should-be-cased-correctly.md) |
51 |
| - |
52 |
| - [CA1709: Identifiers should be cased correctly](../code-quality/ca1709-identifiers-should-be-cased-correctly.md) |
53 |
| - |
54 |
| - [CA1708: Identifiers should differ by more than case](../code-quality/ca1708-identifiers-should-differ-by-more-than-case.md) |
55 |
| - |
56 |
| -## See Also |
57 |
| - [Capitalization Conventions](/dotnet/standard/design-guidelines/capitalization-conventions) |
58 |
| - [Naming Guidelines](/dotnet/standard/design-guidelines/naming-guidelines) |
| 20 | + |
| 21 | +||| |
| 22 | +|-|-| |
| 23 | +|TypeName|ResourceStringCompoundWordsShouldBeCasedCorrectly| |
| 24 | +|CheckId|CA1701| |
| 25 | +|Category|Microsoft.Naming| |
| 26 | +|Breaking Change|Non-breaking| |
| 27 | + |
| 28 | +## Cause |
| 29 | + |
| 30 | +A resource string contains a compound word that does not appear to be cased correctly. |
| 31 | + |
| 32 | +## Rule description |
| 33 | + |
| 34 | +Each word in the resource string is split into tokens that are based on the casing. Each contiguous two-token combination is checked by the Microsoft spelling checker library. If recognized, the word produces a violation of the rule. Examples of compound words that cause a violation are "CheckSum" and "MultiPart", which should be cased as "Checksum" and "Multipart", respectively. Due to previous common usage, several exceptions are built into the rule, and several single words are flagged, such as "Toolbar" and "Filename", that should be cased as two distinct words. In this example, "ToolBar" and "FileName" would be flagged. |
| 35 | + |
| 36 | +Naming conventions provide a common look for libraries that target the common language runtime. This reduces the learning curve that is required for new software libraries, and increases customer confidence that the library was developed by someone who has expertise in developing managed code. |
| 37 | + |
| 38 | +## How to fix violations |
| 39 | + |
| 40 | +Change the word so that it is cased correctly. |
| 41 | + |
| 42 | +## Change the dictionary language |
| 43 | + |
| 44 | +By default, the English (en) version of the spelling checker is used. If you want to change the language of the spelling checker, you can do so by adding one of the following attributes to your *AssemblyInfo.cs* or *AssemblyInfo.vb* file: |
| 45 | + |
| 46 | +- Use <xref:System.Reflection.AssemblyCultureAttribute> to specify the culture if your resources are in a satellite assembly. |
| 47 | +- Use <xref:System.Resources.NeutralResourcesLanguageAttribute> to specify the *neutral culture* of your assembly if your resources are in the same assembly as your code. |
| 48 | + |
| 49 | +> [!IMPORTANT] |
| 50 | +> If you set the culture to anything other than an English-based culture, this code analysis rule is silently disabled. |
| 51 | +
|
| 52 | +## When to suppress warnings |
| 53 | + |
| 54 | +It is safe to suppress a warning from this rule if both parts of the compound word are recognized by the spelling dictionary and the intent is to use two words. |
| 55 | + |
| 56 | +You can also add compound words to a custom dictionary for the spelling checker. Words in the custom dictionary do not cause violations. For more information, see [How to: Customize the Code Analysis Dictionary](../code-quality/how-to-customize-the-code-analysis-dictionary.md). |
| 57 | + |
| 58 | +## Related rules |
| 59 | + |
| 60 | +- [CA1702: Compound words should be cased correctly](../code-quality/ca1702-compound-words-should-be-cased-correctly.md) |
| 61 | +- [CA1709: Identifiers should be cased correctly](../code-quality/ca1709-identifiers-should-be-cased-correctly.md) |
| 62 | +- [CA1708: Identifiers should differ by more than case](../code-quality/ca1708-identifiers-should-differ-by-more-than-case.md) |
| 63 | + |
| 64 | +## See also |
| 65 | + |
| 66 | +- [Capitalization Conventions](/dotnet/standard/design-guidelines/capitalization-conventions) |
| 67 | +- [Naming Guidelines](/dotnet/standard/design-guidelines/naming-guidelines) |
0 commit comments