Files
OpenRA/OpenRA.ruleset
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

80 lines
5.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="OpenRA Code Style" ToolsVersion="14.0">
<IncludeAll Action="Warning" />
<!-- Rules related to generating XML documentation that we need to silence. -->
<!-- These are here because of GenerateDocumentationFile, which is a workaround for forcing rule IDE0005 to work outside of an IDE. -->
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
<Rule Id="CS1570" Action="None" /><!-- Invalid XML in XML comment. -->
<Rule Id="CS1573" Action="None" /><!-- Parameter has no matching param tag in the XML comment. -->
<Rule Id="CS1591" Action="None" /><!-- Missing XML comment for publicly visible type or member. -->
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.CodeStyle" RuleNamespace="Microsoft.CodeAnalysis.CSharp.CodeStyle">
<Rule Id="IDE0005" Action="Warning" /><!-- Using directive is unnecessary. -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SX1101" Action="Warning" /><!-- DoNotPrefixLocalMembersWithThis -->
<!-- Rules that are covered by IDE1006 -->
<Rule Id="SA1300" Action="None" /><!-- ElementMustBeginWithUpperCaseLetter -->
<Rule Id="SA1302" Action="None" /><!-- InterfaceNamesMustBeginWithI -->
<Rule Id="SA1303" Action="None" /><!-- ConstFieldNamesMustBeginWithUpperCaseLetter -->
<Rule Id="SA1304" Action="None" /><!-- NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter -->
<Rule Id="SA1306" Action="None" /><!-- FieldNamesMustBeginWithLowerCaseLetter -->
<Rule Id="SA1307" Action="None" /><!-- AccessibleFieldsMustBeginWithUpperCaseLetter -->
<Rule Id="SA1311" Action="None" /><!-- StaticReadonlyFieldsMustBeginWithUpperCaseLetter -->
<Rule Id="SA1312" Action="None" /><!-- VariableNamesMustBeginWithLowerCaseLetter -->
<Rule Id="SA1313" Action="None" /><!-- ParameterNamesMustBeginWithLowerCaseLetter -->
<!-- Rules that conflict with OpenRA project style conventions -->
<Rule Id="SA0001" Action="None" /><!-- XmlCommentAnalysisDisabled -->
<Rule Id="SA1101" Action="None" /><!-- PrefixLocalCallsWithThis -->
<Rule Id="SA1117" Action="None" /><!-- ParametersMustBeOnSameLineOrSeparateLines -->
<Rule Id="SA1118" Action="None" /><!-- ParameterMustNotSpanMultipleLines -->
<Rule Id="SA1122" Action="None" /><!-- UseStringEmptyForEmptyStrings -->
<Rule Id="SA1124" Action="None" /><!-- DoNotUseRegions -->
<Rule Id="SA1127" Action="None" /><!-- GenericTypeConstraintsMustBeOnOwnLine -->
<Rule Id="SA1135" Action="None" /><!-- UsingDirectivesMustBeQualified -->
<Rule Id="SA1136" Action="None" /><!-- EnumValuesShouldBeOnSeparateLines -->
<Rule Id="SA1200" Action="None" /><!-- UsingDirectivesMustBePlacedCorrectly -->
<Rule Id="SA1201" Action="None" /><!-- ElementsMustAppearInTheCorrectOrder -->
<Rule Id="SA1202" Action="None" /><!-- ElementsMustBeOrderedByAccess -->
<Rule Id="SA1314" Action="None" /><!-- TypeParameterNamesMustBeginWithT -->
<Rule Id="SA1400" Action="None" /><!-- AccessModifierMustBeDeclared -->
<Rule Id="SA1401" Action="None" /><!-- FieldsMustBePrivate -->
<Rule Id="SA1402" Action="None" /><!-- FileMayOnlyContainASingleType -->
<Rule Id="SA1407" Action="None" /><!-- ArithmeticExpressionsMustDeclarePrecedence -->
<Rule Id="SA1501" Action="None" /><!-- StatementMustNotBeOnSingleLine -->
<Rule Id="SA1502" Action="None" /><!-- ElementMustNotBeOnSingleLine -->
<Rule Id="SA1503" Action="None" /><!-- BracesMustNotBeOmitted -->
<Rule Id="SA1519" Action="None" /><!-- BracesMustNotBeOmittedFromMultiLineChildStatement -->
<Rule Id="SA1520" Action="None" /><!-- UseBracesConsistently -->
<Rule Id="SA1600" Action="None" /><!-- ElementsMustBeDocumented -->
<Rule Id="SA1601" Action="None" /><!-- PartialElementsMustBeDocumented -->
<Rule Id="SA1602" Action="None" /><!-- EnumerationItemsMustBeDocumented -->
<Rule Id="SA1633" Action="None" /><!-- FileMustHaveHeader -->
<Rule Id="SA1649" Action="None" /><!-- FileNameMustMatchTypeName -->
<!-- Rules that could potentially be enabled after existing violations are fixed -->
<Rule Id="SA1027" Action="None" /><!-- UseTabsCorrectly -->
<Rule Id="SA1107" Action="None" /><!-- CodeMustNotContainMultipleStatementsOnOneLine -->
<Rule Id="SA1116" Action="None" /><!-- SplitParametersMustStartOnLineAfterDeclaration -->
<Rule Id="SA1119" Action="None" /><!-- StatementMustNotUseUnnecessaryParenthesis -->
<Rule Id="SA1132" Action="None" /><!-- DoNotCombineFields -->
<Rule Id="SA1204" Action="None" /><!-- StaticElementsMustAppearBeforeInstanceElements -->
<Rule Id="SA1214" Action="None" /><!-- ReadonlyElementsMustAppearBeforeNonReadonlyElements -->
<Rule Id="SA1413" Action="None" /><!-- UseTrailingCommasInMultiLineInitializers -->
<Rule Id="SA1516" Action="None" /><!-- ElementsMustBeSeparatedByBlankLine -->
<Rule Id="SA1604" Action="None" /><!-- ElementDocumentationShouldHaveSummary -->
<Rule Id="SA1611" Action="None" /><!-- ElementParametersShouldBeDocumented -->
<Rule Id="SA1615" Action="None" /><!-- ElementReturnValueShouldBeDocumented -->
<Rule Id="SA1618" Action="None" /><!-- GenericTypeParametersShouldBeDocumented -->
<Rule Id="SA1623" Action="None" /><!-- PropertySummaryDocumentationShouldMatchAccessors -->
<Rule Id="SA1629" Action="None" /><!-- DocumentationTextShouldEndWithAPeriod -->
<Rule Id="SA1642" Action="None" /><!-- ConstructorSummaryDocumentationShouldBeginWithStandardText -->
</Rules>
</RuleSet>