diff --git a/src/.editorconfig b/src/.editorconfig index a4dae23..0561b1d 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -390,7 +390,8 @@ dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity # All static readonly fields must be PascalCase # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private -dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly +# dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly +dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style @@ -425,9 +426,9 @@ dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = s # Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#). dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = * dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error +dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group +dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style +dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error #### Other Naming Rules #### diff --git a/src/Tests/CodeAnalysisTest/OrganizeMembersTest.cs b/src/Tests/CodeAnalysisTest/OrganizeMembersTest.cs index fc4319a..a4f9206 100644 --- a/src/Tests/CodeAnalysisTest/OrganizeMembersTest.cs +++ b/src/Tests/CodeAnalysisTest/OrganizeMembersTest.cs @@ -44,14 +44,44 @@ public OrganizeMembersTest(bool boolProp, string strProp, int myField) _boolProp = boolProp; _strProp = strProp; _myField = myField; + + _field1 = 0; + _field2 = 0; } + // Field3 + private static readonly int Field3 = 1; + private int _field1; + private static string Field4 = string.Empty; + /// + /// Skip initialized fields + /// + private const string Const2 = "My Model"; + // one line comment + private const int Const1 = 140; + + /// public Task TaskMethodAsync(CancellationToken cancellationToken) { throw new NotImplementedException(); } + private void MethodName() + { + Console.WriteLine(_field1); + Console.WriteLine(_field2); + Console.WriteLine(Field3); + Console.WriteLine(Field4); + + throw new NotImplementedException(); + } + /// + /// The field2 + /// + private int _field2; + + Task IImplicit.TaskMethodAsync(CancellationToken cancellationToken) { throw new NotImplementedException();