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 .NET framework naming rules #1267

Open
ErikSchierboom opened this issue Apr 1, 2019 · 11 comments
Open

Enforce .NET framework naming rules #1267

ErikSchierboom opened this issue Apr 1, 2019 · 11 comments

Comments

@ErikSchierboom
Copy link
Member

The official C# capitalization conventions define how things should be named in C#. Note that these are officially guidelines, but they are followed by virtually everyone. As such, they are the de facto standard and we should make any violation of the naming conventions an error. See:

@SleeplessByte
Copy link
Member

The fact that they're official makes me inclined to just enforce, at least as a warning, maybe even as error.

As far as I can tell from the links that you've provided, they're guidelines only because C# does not have a language feature to block on improper naming and this document was not available pre version 1. This allows older code to work always, but not necessarily make it a loose rule.

@ErikSchierboom
Copy link
Member Author

As far as I can tell from the links that you've provided, they're guidelines only because C# does not have a language feature to block on improper naming

That is correct, and it is about to change (with version 3 of the Roslyn compiler). Would you prefer a warning or an error?

@SleeplessByte
Copy link
Member

If it will error later, make it an error now. It will still compile but show up as error which is a nice intermediary

@ErikSchierboom
Copy link
Member Author

Well, I'm not sure it will be an error, but it will be enforceable in the future. So still an error?

@SleeplessByte
Copy link
Member

Yeah. I think it makes sense. My argument is always: if it's official, there will be tooling. If there's tooling, there's official dependency on it following the guidelines.

Therefore enforce via error.

@ErikSchierboom
Copy link
Member Author

Sound reasoning. I'll do a PR.

@ErikSchierboom
Copy link
Member Author

I've looked into it, and the editors (VS/VS Code/Rider) don't currently enforce the editorconfig settings. We can revisit this once the editorconfig support has been baked into the compiler. Progress for this feature can be checked here.

@valentin-p
Copy link
Contributor

I think that should help unblock this issue:

https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#enable-on-build

@ErikSchierboom
Copy link
Member Author

Yeah, that looks good.

@vaeng
Copy link
Contributor

vaeng commented Oct 30, 2024

@ErikSchierboom
Should this feature be baked into the Analyzer?

@ErikSchierboom
Copy link
Member Author

That might be a good idea, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants