question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] Add Editorconfig to Enforce Code Quality

See original GitHub issue

Description 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 vs myVariable vs MyVariable 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

6reactions
bdukescommented, Oct 21, 2019

Regarding auto-linting vs. build failures "Why don't we have both?" GIF

1reaction
SkyeHoeflingcommented, Oct 21, 2019

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.

  • Create .editorconfig
  • Apply .editorconfig to all files
  • Added linter to build or GitHub Actions

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

EditorConfig settings - Visual Studio (Windows)
You can add an EditorConfig file to your project or codebase to enforce consistent coding styles for everyone that works in the codebase....
Read more >
Enforce .NET Code Style With .editorconfig | by Josef Eiter
You can add an EditorConfig file to your project or codebase to enforce consistent coding styles for everyone that… docs.microsoft.com ...
Read more >
Why You Should Use EditorConfig to Standardize Code ...
EditorConfig Makes Code Reviews Easier​​ Enforcing formatting should be delegated to software. This will make reading and reviewing the code more ...
Read more >
RFC 69: C/C++ Code Formatting
editorconfig file is provided to automatically tell popular code editors about the basic style settings like indentation, whitespaces and end-of-line markers ...
Read more >
Untitled
This means you can add EditorConfig files to your workspace to ... documentation Creating and Enforcing a Code Formatting Standard with clang-format ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found