[RFC] Add Editorconfig to Enforce Code Quality
See original GitHub issueDescription of Problem
Throughout the platform there are many code quality concerns such as
- Different line endings
- spaces vs tabs
- variable declaration styles such as
_myVariable
vsmyVariable
vsMyVariable
for private variables - Curly braces on same line or new line
Everything listed above are mixed scenarios I have found throughout the platform and we don’t have a strict coding standard. All of these mismatched coding styles make it difficult for contributors and the maintainers to review Pull Request. If the entire code-base is updated to a consistent coding style the maintainability of the platform will increase.
I propose we implement a coding standard and enforce it using editorconfig. This was brought up in another RFC #2454 by @mtrutledge and I think we consider implementing it to guarantee coding standards.
Proposed Solution Option 1
I propose we adopt the .NET C# coding guidelines from Microsoft that is being used in many .NET Foundation projects documented in the dotnet/corefx project.
We should be able to re-use the .editorconfig from the BCL project dotnet/corefx with minimal changes.
Proposed Solution Option 2 (If Needed, repeat for more)
There are other tools out there, from my experience editorconfig appears to be an industry standard across .NET Foundation Open Source Projects
Alternatives Researched
Open to hearing other thoughts on this
Affected version
- 10.0.0 nightly build
- 9.4.1 nightly build
- 9.4.0 latest supported release
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (11 by maintainers)
Top GitHub Comments
Regarding auto-linting vs. build failures
I have not looked at ReSharper Command Line tools but we can certainly look into that. This opens a bigger question I have
Auto-Linting vs Lint Failures
Do we want a GitHub Action to auto-lint PRs or do we want it to fail the Azure DevOps build. I personally prefer the build failure as I don’t 100% trust code linters. I see lots of value in using an Auto-Linter with GitHub Actions.
Complexity???
If we create a work item from this RFC and move forward I think we should break this out to smaller manageable chunks.
If we add an .editorconfig it won’t automatically be applied to old files, but it will work for new files. I think this is the first step as doing this all at once is proving to be a massive change.