Skip to content

Commit 4b609a0

Browse files
authored
Update SA1305 doc to mention allowedHungarianPrefixes in stylecop.json
1 parent fdb3d67 commit 4b609a0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

documentation/SA1305.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,17 @@ In addition, modern code editors such as Visual Studio make it easy to identify
2929

3030
StyleCop assumes that any variable name that begins with one or two lower-case letters followed by an upper-case letter is making use of Hungarian notation, and will flag a violation of this rule in each case. It is possible to declare certain prefixes as legal, in which case they will be ignored. For example, a variable named *onExecute* will appear to StyleCop to be using Hungarian notation, when in reality it is not. Thus, the *on* prefix should be flagged as an allowed prefix.
3131

32-
To configure the list of allowed prefixes, bring up the StyleCop settings for a project, and navigate to the Hungarian tab, as shown below:
33-
34-
![](Images/HungarianSettings.JPG)
32+
To configure the list of allowed prefixes, use *stylecop.json* like the following:
33+
34+
```json
35+
{
36+
"settings": {
37+
"namingRules": {
38+
"allowedHungarianPrefixes": [ "aa", "bb" ],
39+
},
40+
}
41+
}
42+
```
3543

3644
Adding a one or two letter prefix to this list will cause StyleCop to ignore variables or fields which begin with this prefix.
3745

0 commit comments

Comments
 (0)