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

Enforce additional style rules. #20726

Merged
merged 2 commits into from Mar 17, 2023
Merged

Conversation

RoosterDragon
Copy link
Member

@RoosterDragon RoosterDragon commented Mar 4, 2023

Enforce another selection of style rules. These have no existing violations so no code changes needed - just need to decide if we're happen to apply these or not. See docs for details of each rule: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/


As requested, also reformats the editorconfig file to make it friendlier to edit:

  • Group style rules with their associated options in a way that matches the documentation. This makes it easier to pair rules and their options.
  • Remove OpenRA.ruleset and move all rules into .editorconfig file.
  • Centralise IDE0005 workaround in Directory.Build.props file.

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

PunkPun commented Mar 9, 2023

Apart from very inconsistent punctuation LGTM

.editorconfig Outdated
dotnet_naming_symbols.const_fields.applicable_accessibilities = *
dotnet_naming_symbols.const_fields.required_modifiers = const
# IDE0040 Add accessibility modifiers
dotnet_style_require_accessibility_modifiers = omit_if_default #for_non_interface_members
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#for_non_interface_members is that to be enabled in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a comment to indicate the default value of the setting. Since OpenRA prefers to have implicit accessibility eveyrwhere, we change to omit_if_default instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there really a reason to list the default value? I don't see the benefit of that and it is just confusing because you don't know if that is a future TODO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If something is a TODO then it will/should say "TODO: ...".
But I do agree specifying the default values that we override is redundant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the comments when defaults overridden.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we aren't worried that this will become a maintenance overhead, I'm all for displaying default values. It saves a bunch of hassle when working with rules

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your concrete usecase that would be a hassle? If we don't use the default then there is a reason for it. And if not this should be a TODO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's great for when we want to change rules again, whenever that will be

.editorconfig Outdated Show resolved Hide resolved
make.ps1 Show resolved Hide resolved
.editorconfig Outdated
dotnet_naming_symbols.const_fields.applicable_accessibilities = *
dotnet_naming_symbols.const_fields.required_modifiers = const
# IDE0040 Add accessibility modifiers
dotnet_style_require_accessibility_modifiers = omit_if_default #for_non_interface_members
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If something is a TODO then it will/should say "TODO: ...".
But I do agree specifying the default values that we override is redundant.

Makefile Show resolved Hide resolved
Directory.Build.props Outdated Show resolved Hide resolved
@penev92
Copy link
Member

penev92 commented Mar 14, 2023

Oooh, also has an actual conflict in .editorconfig, so definitely needs a rebase.

PunkPun
PunkPun previously approved these changes Mar 14, 2023
Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM

- Group style rules with their associated options in a way that matches the documentation. This makes it easier to pair rules and their options.
- Remove OpenRA.ruleset and move all rules into .editorconfig file.
- Centralise IDE0005 workaround in Directory.Build.props file.
@abcdefg30 abcdefg30 merged commit 88ba974 into OpenRA:bleed Mar 17, 2023
3 checks passed
@abcdefg30
Copy link
Member

Changelog

@RoosterDragon RoosterDragon deleted the style-easy branch March 18, 2023 09:12
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

4 participants