-
Notifications
You must be signed in to change notification settings - Fork 119
Adds an .editorconfig file, formats, and resolves analyzer issues #436
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
Conversation
|
This PR is great! This repo has been missing lint checks for a long time. The format check should be added to the azure pipeline. |
| /// A disabled feature handler that wraps an inline handler. | ||
| /// </summary> | ||
| class InlineDisabledFeaturesHandler : IDisabledFeaturesHandler | ||
| sealed class InlineDisabledFeaturesHandler : IDisabledFeaturesHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recalled someone saying sealing classes is a breaking change, but the warning message convinced me it was okay in this case:
CA1852 Type 'InlineDisabledFeaturesHandler' can be sealed because it has no subtypes in its containing assembly and is not externally visible
If we think it's still breaking- or just don't want to risk it I can disable this rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh it's not a public type. Then indeed it can be sealed without a breaking change.
| } | ||
| ArgumentNullException.ThrowIfNull(app); | ||
|
|
||
| if (string.IsNullOrEmpty(featureName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confused why it would suggest Argument.ThrowIfNull for null checks, but not ThrowIfNullOrEmpty for string checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same thought. Turns out ThrowIfNull was added in .NET 6 while ThrowIfNullOrEmpty was added in .NET 7. And we still have .NET 6 as a target.
|
This is the type of change that is cross-repo. If we were to adopt this, all repos in our scope should adopt it. |
|
Adjusted the Now, the the |
|
A reference for all the format rules: |
818553d to
4d26e2f
Compare
e33092a to
3bc8d22
Compare
|
Move to #472 |

Why this PR?
What was done?
a. This is modified from the default .editorconfig generated by Visual Studio.
dotnet formatFeatureManagementandFeatureManagement.AspNetCorewithEnforceCodeStyleInBuild: true. This means warnings will show in a build when the code style is not being followed.Adding an
.editorconfigenables code formatting and code analyzing tools to work. Simply by adding this file, Visual Studio and other IDEs will now respect the style choices for this project when making changes within it. Additionally, this unlocks GitHub actions that can evaluate code style and formatting and catch small mistakes for us.Visible Changes
No visible changes
Philosophy
Code styles should never feel like a hurdle or a headache that we need to adhere to- so at no point should these changes block or slow development. However I believe adding this file allows for a clear definition of rules, a clear place to change style choices as we see fit, and enables IDEs & tooling to quickly follow suit.
This also means all other PRs will be cleaner- as any code style issues will already be caught and handled by tooling.