Closed rossgrambo closed 4 months ago
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.
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 AnalysisLevel
in csproj file to suppress CA1848 and CA2254 warnings:
Now, the AnalysisLevel
for Microsoft.FeatureManagement
is 5.0 because Microsoft.FeatureManagement
is targeted on netstandard and 5.0 is the lowest AnalysisLevel which was available for the .NET 5 release is used.
the AnalysisLevel
for Microsoft.FeatureManagement.AspNetCore
is 6.0 because Microsoft.FeatureManagement.AspNetCore
is targeted on .NET 6.0.
A reference for all the format rules: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options
Move to #472
Why this PR?
What was done?
dotnet format
FeatureManagement
andFeatureManagement.AspNetCore
withEnforceCodeStyleInBuild: true
. This means warnings will show in a build when the code style is not being followed.Adding an
.editorconfig
enables 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.