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 readonly #19890

Merged
merged 2 commits into from
Jan 22, 2022
Merged

Conversation

penev92
Copy link
Member

@penev92 penev92 commented Jan 20, 2022

Step Nth in our quest for moar code style rules!!! Now we finally take on the infamous readonly modifier that gets skipped so often.

Activating the rule (IDE0044) and fixing the subsequent issues lead to a new batch of issues - there are a bunch of places that light up with error SA1311: Static readonly fields should begin with upper-case letter, which left me with two choices - silence that rule or fix these issues as well. I started fixing them, but at some point realized that rule IDE1006 (also configured in the .editorconfig) is the IDE version of the same thing and it is explicitly silenced, so as a first option I went with that. If people decide against it then I'll change it.

P.S.: Big but incredibly easy to review PR 😛

Pinging @RoosterDragon for a review please.

.editorconfig Outdated Show resolved Hide resolved
@RoosterDragon
Copy link
Member

None the the changes look to be for areas that would involve reflection, so happy with those.

Currently the naming rules in editorconfig don't align with the SA13XX rules we have enabled and that will want fixing separately so if we ever enabled IDE1006 at build time it wouldn't conflict with the SA13XX rules we have enabled. Happy to disable the rule and we can revisit naming conventions as part of that exercise.

Also added a rule to silence StyleCop complaining about StaticReadonlyFieldsMustBeginWithUpperCaseLetter to match what we already have configured for the IDE.
@penev92
Copy link
Member Author

penev92 commented Jan 22, 2022

Moved the StyleCop rule to OpenRA.ruleset as requested.

@pchote pchote merged commit 70e2769 into OpenRA:bleed Jan 22, 2022
@penev92 penev92 deleted the codeStyleRules-readonly branch January 31, 2022 22:22
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

3 participants