Skip to content

Commit bf25f51

Browse files
committed
An early attempt at updating documentation
1 parent b66a00c commit bf25f51

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers/NamingRules/SA1300ElementMustBeginWithUpperCaseLetter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ namespace StyleCop.Analyzers.NamingRules
3030
/// class. A <c>NativeMethods</c> class is any class which contains a name ending in <c>NativeMethods</c>, and is
3131
/// intended as a placeholder for Win32 or COM wrappers. StyleCop will ignore this violation if the item is placed
3232
/// within a <c>NativeMethods</c> class.</para>
33+
///
34+
/// <para>For namespace components that begin with a small letter, due to branding issues or other reasons, add the
35+
/// term to the <c>allowedNamespaceComponentTerms</c> list.</para>
3336
/// </remarks>
3437
[DiagnosticAnalyzer(LanguageNames.CSharp)]
3538
internal class SA1300ElementMustBeginWithUpperCaseLetter : DiagnosticAnalyzer

StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@
128128
"uniqueItems": true
129129
}
130130
},
131+
"allowedNamespaceComponentTerms": {
132+
"type": "array",
133+
"description": "Allowed namesapce component terms, such as ones beginning with a lowercase letter.",
134+
"default": [],
135+
"items": {
136+
"type": "string",
137+
"uniqueItems": true
138+
}
139+
},
131140
"includeInferredTupleElementNames": {
132141
"type": "boolean",
133142
"description": "Specifies whether inferred tuple element names will be analyzed as well.",

documentation/Configuration.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,30 @@ The following example shows a settings file which allows the common prefixes as
314314
}
315315
```
316316

317+
### Namespace Components
318+
319+
The following property is used to configure allowable namespace component terms (e.g. ones that start with a lowercase letter).
320+
321+
| Property | Default Value | Minimum Version | Summary |
322+
| --- | --- | --- | --- |
323+
| `allowedNamespaceComponentTerms` | `[ ]` | 1.2.0 | Specifies namespace component terms that are allowed to be used. See the example below for more information. |
324+
325+
The following example shows a settings file which allows the namespace such as `eBay` or `Apple.iPod`.
326+
327+
```json
328+
{
329+
"settings": {
330+
"namingRules": {
331+
"allowedNamespaceComponentTerms": [
332+
"eBay",
333+
"iPod"
334+
]
335+
}
336+
}
337+
}
338+
```
339+
340+
317341
### Tuple element names
318342

319343
The following properties are used to configure the behavior of the tuple element name analyzers.

documentation/SA1300.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ begin with a lower-case letter, place the field or variable within a special `Na
4242
class is any class which contains a name ending in `NativeMethods`, and is intended as a placeholder for Win32 or COM
4343
wrappers. StyleCop will ignore this violation if the item is placed within a `NativeMethods` class.
4444

45+
For namespace components that begin with a small letter, due to branding issues or other reasons, add the appropriate
46+
term to the `allowedNamespaceComponentTerms` list.
47+
4548
## How to fix violations
4649

47-
To fix a violation of this rule, change the name of the element so that it begins with an upper-case letter, or place
48-
the item within a `NativeMethods` class if appropriate.
50+
To fix a violation of this rule, change the name of the element so that it begins with an upper-case letter, place
51+
the item within a `NativeMethods` class if appropriate, or add it to the `allowedNamespaceComponentTerms` list if
52+
it is a namespace component.
4953

5054
## How to suppress violations
5155

0 commit comments

Comments
 (0)