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 consistent code styles between framework and other projects like the analyzers #4061

Closed
stevenaw opened this issue Mar 14, 2022 · 4 comments

Comments

@stevenaw
Copy link
Member

stevenaw commented Mar 14, 2022

Something which has come up in PRs a few times recently is that the framework has a more lax editorconfig ruleset than the analyzers project (and potentially others??). It specifically came up in the bracing style for a multi-line loop, but at a glance there's several other styling differences in the editorconfigs. For example:

foreach (var x in items)
  if (x.BoolTest)
    x.DoSomething();

The analyzers project has a rule to suggest explicit use of braces in the foreach but not the if statement. The framework's editorconfig doesn't have this rule, and it has resulted in some PR feedback on recent framrwork PRs. We should consider updating the framework editorconfig so that the tooling can better guides contributors on any preferred style guidelines.

@manfred-brands
Copy link
Member

The main thing Is to get it part of the checking whilst editing, then things will stay consistent. Configuring the rules is relatively easy once agreed upon.
It is possible to align this between repositories if that is something the core team wants. But not necessary if the editor helps you, it is not to bad switching.
At my work we install a single NuGet package to get consistent rules between a large set of repositories.

@CharliePoole
Copy link
Contributor

Bear in mind that the Core Team doesn't have the role of "enforcing" particular standards or processes on member projects. That means it takes negotiation across projects rather than a decision by the Core Team. This is a feature of our governance policy, rather than a bug. :-)

That's not an obstacle to what you are trying to do here - it's just that you have to do it project by project and this is the right place to propose it for the framework project.

@stevenaw
Copy link
Member Author

Thanks @CharliePoole
That had indeed been my thinking here: to start a chat about adopting any further style conventions for the framework project, and to configure tooling such as editorconfig so that they can be applied automatically ("enforced" was perhaps a strong word to have initially used for this).

@stevenaw
Copy link
Member Author

I'm going to close this. It hasn't seen much interest in discussion here, though editorconfig changes have been getting organically added in PRs as conversations come up.

@stevenaw stevenaw closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2022
@stevenaw stevenaw added this to the Closed Without Action milestone Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants