Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SA1305 doc to mention allowedHungarianPrefixes in stylecop.json #3321

Merged
merged 2 commits into from
Mar 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions documentation/SA1305.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ In addition, modern code editors such as Visual Studio make it easy to identify

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.

To configure the list of allowed prefixes, bring up the StyleCop settings for a project, and navigate to the Hungarian tab, as shown below:

![](Images/HungarianSettings.JPG)
To configure the list of allowed prefixes, use **stylecop.json** like the following:

```json
{
"settings": {
"namingRules": {
"allowedHungarianPrefixes": [ "aa", "bb" ],
},
}
}
```

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

Expand Down