From 70e2769a85a9a608f31615488b8bbb441c19efd1 Mon Sep 17 00:00:00 2001 From: penev92 Date: Thu, 20 Jan 2022 00:45:15 +0200 Subject: [PATCH] Added a rule about the readonly modifier Also added a rule to silence StyleCop complaining about StaticReadonlyFieldsMustBeginWithUpperCaseLetter to match what we already have configured for the IDE. --- .editorconfig | 5 ++++- OpenRA.ruleset | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 91d8440c0b..84e4c67134 100644 --- a/.editorconfig +++ b/.editorconfig @@ -63,7 +63,7 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case -# IDE1006, IDE-only counterpart of StyleCopAnalyzers - SA1311: StaticReadonlyFieldsMustBeginWithUpperCaseLetter. +# IDE1006, IDE-only counterpart of StyleCopAnalyzers - SA1311: StaticReadonlyFieldsMustBeginWithUpperCaseLetter (silenced in OpenRA.ruleset). dotnet_naming_rule.static_private_or_internal_field_should_be_pascal_case.severity = none dotnet_naming_rule.static_private_or_internal_field_should_be_pascal_case.symbols = static_private_or_internal_field dotnet_naming_rule.static_private_or_internal_field_should_be_pascal_case.style = pascal_case @@ -124,6 +124,9 @@ dotnet_diagnostic.IDE0036.severity = warning # Raise a warning on build when default access modifiers are explicitly specified. dotnet_diagnostic.IDE0040.severity = warning +# Make field readonly. +dotnet_diagnostic.IDE0044.severity = warning + # Avoid unnecessary zero-length array allocations. dotnet_diagnostic.CA1825.severity = warning diff --git a/OpenRA.ruleset b/OpenRA.ruleset index 10d9441655..e364edaacf 100644 --- a/OpenRA.ruleset +++ b/OpenRA.ruleset @@ -55,6 +55,7 @@ + @@ -65,4 +66,4 @@ - \ No newline at end of file +