Style: Update StyleCop rules (#8500)

This commit is contained in:
Dongbo Wang 2019-04-02 22:09:56 -07:00 committed by Ilya
parent 2b4fe626b7
commit 74b71f2f39
2 changed files with 61 additions and 2 deletions

View file

@ -12,6 +12,19 @@
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldsMustBePrivate">
<!-- it's OK to have internal or public fields -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeAnalysisSuppressionMustHaveJustification">
<!-- code analysis SuppressMessage attributes are from legacy code,
it's OK to not include a justification. -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
@ -83,7 +96,10 @@
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
<AnalyzerSettings>
<BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
<BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
</AnalyzerSettings>
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<Rules>
@ -92,6 +108,24 @@
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VariableNamesMustNotBePrefixed">
<!-- this rule disallows the prefix 's_' to static fields -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyFieldsMustBeginWithUpperCaseLetter">
<!-- this rule requires first letter upper-case even for private fields -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotContainUnderscore">
<!-- this rule disallows '_' in field name -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
@ -117,6 +151,31 @@
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticElementsMustAppearBeforeInstanceElements">
<!-- it's OK to have static members after instance members -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="ElementMustNotBeOnSingleLine">
<!-- it's OK to have simple member on a single line.
think about the 'Visit*' methods in Ast visitor class. -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AllAccessorsMustBeSingleLineOrMultiLine">
<!-- it's OK to have the getter be on a single line and the
setter be on multiple lines, or vice versa -->
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>

View file

@ -25,7 +25,7 @@
},
"namingRules" : {
"allowCommonHungarianPrefixes" : true,
"allowedHungarianPrefixes" : [ "c", "r" ]
"allowedHungarianPrefixes" : [ "n", "r", "l", "i", "io", "fs", "lp", "dw", "h", "rs", "ps", "op" ]
},
"maintainabilityRules" : {
"topLevelTypes" : [