Commit Graph

13 Commits

Author SHA1 Message Date
RoosterDragon
9cd55df584 Ensure editorconfig naming styles align with StyleCop SA13XX style rules.
Aligns the naming conventions defined in editorconfig (dotnet_naming_style, dotnet_naming_symbols, dotnet_naming_rule) which are reported under the IDE1006 rule with the existing StyleCop rules from the SA13XX range.

This ensures the two rulesets agree when rejecting and accepting naming conventions within the IDE, with a few edges cases where only one ruleset can enforce the convention. IDE1006 allows use to specify a naming convention for type parameters, const locals and protected readonly fields which SA13XX cannot enforce. Some StyleCop SA13XX rules such as SA1309 'Field names should not begin with underscore' are not possible to enforce with the naming rules of IDE1006.

Therefore we enable the IDE1006 as a build time warning to enforce conventions and extend them. We disable SA13XX rules that can now be covered by IDE1006 to avoid double-reporting but leave the remaining SA13XX rules that cover additional cases enabled.

We also re-enable the SA1311 rule convention but enforce it via IDE1006, requiring some violations to be fixed or duplication of existing suppressions. Most violations fixes are trivial renames with the following exception. In ActorInitializer.cs, we prefer to make the fields private instead. ValueActorInit provides a publicly accessible property for access and OwnerInit provides a publicly accessible method. Health.cs is adjusted to access the property base instead when overriding. The reflection calls must be adjusted to target the base class specifically, as searching for a private field from the derived class will fail to locate it on the base class.

Unused suppressions were removed.
2022-02-07 19:14:45 +01:00
penev92
70e2769a85 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.
2022-01-22 18:47:06 +00:00
penev92
e1e76411f7 Added a rule for unused usings to OpenRA.ruleset
Unfortunately due to bugs in the analyzers or something else, the IDE0005 doesn't work as expected. The "officially suggested" workaround is to enable XML documentation generation to trigger IDE0005 during compiling. Then we need to add three more rules to silence the warnings that come from the XML documentation generation. We also need to enable code style enforcing on build for all of this to work.
Known issue is that all of this produces a bunch (tens to hundreds) of obscure analyzer warnings on older versions of Visual Studio, but those seem to not be causing issues.
2021-10-15 13:12:33 +02:00
RoosterDragon
58dced7e05 Silence some doc errors in VS2019. 2019-06-21 21:22:12 +02:00
Paul Chote
788e73db64 Enable StyleCop rule SA1115. 2019-06-08 19:28:14 +02:00
Paul Chote
4dd08d9dc2 Enable StyleCop rule SA1500. 2019-06-08 19:26:53 +02:00
Paul Chote
c89f8dbb89 Enable StyleCop rule SA1002. 2019-06-08 18:46:03 +02:00
Paul Chote
4d8aaeb690 Enable StyleCop rule SA1128. 2019-06-08 18:44:50 +02:00
Paul Chote
1d3754f9c0 Enable StyleCop rules SA1509, SA1513. 2019-06-08 13:20:14 +02:00
Paul Chote
208b5b9686 Enable StyleCop rule SA1129. 2019-06-08 13:19:57 +02:00
Paul Chote
37889af20e Enable StyleCop rule SX1101 2019-06-08 13:19:27 +02:00
Paul Chote
78a70be0d4 Fix and enable SA1133, SA1134 style rules. 2019-05-24 10:47:57 +02:00
Paul Chote
ba282865f1 Replace legacy StyleCop(Plus) with StyleCopAnalyzers
Analyzers are enabled in the Debug configuration
only to avoid unnecessary overheads when compiling
normally.
2019-05-09 20:40:08 +02:00