Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style rules cleanup #19801

Merged
merged 4 commits into from
Jan 9, 2022
Merged

Conversation

penev92
Copy link
Member

@penev92 penev92 commented Nov 14, 2021

Between
.editorconfig
OpenRA.ruleset
OpenRA.sln.DotSettings
stylecop.json
I felt our code style rules configuration is all over the place. So I took a peek inside them and it turns out two of them have been made redundant over the years.

  • stylecop.json only contains generic file formatting rules that are already(/now) covered by .editorconfig
  • OpenRA.sln.DotSettings contains C# field naming rules that are already covered by code analyzers and a rule about default access modifiers, that we can cover with an .editorconfig setting

Also removed some obsolete entries from .gitignore.

(I am going to try and sneak this onto the release milestone. If it proves problematic somehow we can remove it.)

@penev92 penev92 added this to the Next release milestone Nov 14, 2021
.editorconfig Outdated Show resolved Hide resolved
Removed some obsolete entries now that there is a new build directory.
It currently has two functions, both of which are covered by our .editorconfig file.
@penev92
Copy link
Member Author

penev92 commented Jan 5, 2022

The initial goal of making ReSharper respect our non-standard rule of omitting explicit access modifiers is looking like a failure, but the cleanup is still worth and we now get CI enforcement of that rule, so overall I rate this a win.

P.S.: The misleading warning text for explicit access modifiers still applies, but that's the best we're going to get until the .NET people fix it.

.editorconfig Outdated Show resolved Hide resolved
RoosterDragon
RoosterDragon previously approved these changes Jan 5, 2022
 - The DEFAULT_PRIVATE_MODIFIER behaviour is now handled by the .editorconfig file via `dotnet_style_require_accessibility_modifiers = omit_if_default:warning`.
 Also added `dotnet_diagnostic.IDE0040.severity = warning` there to raise compile-time errors in the CI.
 - The field naming conventions seem to already be covered by (some) analyzer rules (checked in both VS and VSCode) - IDE1006/SA1306 and SA1307.
@penev92
Copy link
Member Author

penev92 commented Jan 5, 2022

Fixed the new comments in .editorconfig as suggested by @abcdefg30.

@penev92 penev92 added this to the Next release milestone Jan 9, 2022
@Mailaender Mailaender merged commit b679544 into OpenRA:bleed Jan 9, 2022
@penev92 penev92 deleted the codeStyleRulesCleanup branch January 9, 2022 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants