-
Notifications
You must be signed in to change notification settings - Fork 778
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
Reduce StyleCop terseness #156
Comments
What rules are you referring to? |
@lmolkova could maybe give some more insight as she brought this up in the weekly meeting, but I think the major complaints were around nitpicky sort of style things that should theoretically be automatically fixed (like trailing commas or newlines)? |
I agree but fact is: They are were/are not. I fixed a few thousand warnings where a good part were whitespacing issues that also lead to bad readability and thank god for the ability to apply fixes to solutions... The thing is, while it may be nitpicking - disabling rules will lead to them not being followed and no one noticing it in reviews. |
Just my personal opinion: I'm ok with strict style rules. It avoids errors that would need follow up commits, just to fix styling. What I am slightly annoyed by, is the "every methods needs XML documentation" rule. I am absolutely FOR having clear and good documentation on the most crucial public API's, but not for every single method (that just clutters the code). |
Basically, if we choose to have some rules, especially nitpicking like whitespaces or double empty lines, we can make development better by
Possible solutions could be:
Particular complaints:
I will be looking into solving some of this problems as time permits. Any feedback is welcome. |
@lmolkova That is more to the point and allows for discussion! Let me address some of your bullet points:
YES PLEASE! But how?
Absolutely! And I agree, that
Yes, I agree! What I would do here in case of a larger refactoring, is to disable
Not sure stylecop is the bad guy here since builds on the CLI do not suffer from the laggy behavior VS does! So
would something we should definitely do! |
OmniSharp seems to have added .editorconfig support (https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.21.0) just yesterday, would that do auto clean-up once it makes it into VSC? |
There is an .editorconfig extension for vscode that’s been around a long time: https://github.com/editorconfig/editorconfig-vscode The issues around code fixes for stylecop (or any Roslyn analyzer) has been an on going thing for years now. The analyzers use internal API that Visual Studio calls via reflection to apply fixes. It took a long time, but OmniSharp now supports analyzers (including stylecop); it’s just disabled by default: https://www.strathweb.com/2019/04/roslyn-analyzers-in-code-fixes-in-omnisharp-and-vs-code/ |
So the first step I want to take - usings inside namespaces (as it hurts me the most):
Considering low (or no) value of this rule and a lot of distraction it brings, I suggest we disable it and reformat all code to put using outside. Thoughts? |
I concur. I've never worked on a project that had usings inside the namespace, fwiw, and conventionally most .NET projects I've seen have them outside as well. |
I worked on projects that had it in both ways. In projects where usings were inside the namespace it required extra effort to note this in code reviews of new contributors, fix resharper and stylecop, etc. I second Liudmila - it's more efficient from day-to-day perspective to have usings outside the namespace. |
Hi all, looking at this thread, can i start creating PR's following the StyleCop guidelines in the project? The first i was looking for is about the using inside the class. What do u think? |
@eddynaka that would be great. I think we agreed on using outside the class. But other stylecop rules might be worth fixing. You can start switching projects from using https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/build/OpenTelemetry.prod.loose.ruleset to https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/build/OpenTelemetry.prod.ruleset One project at a time =). |
@SergeyKanzhelev , thanks for the tip! that makes thing a lot easier! Just created the first PR. Let me know what do you think :) |
@SergeyKanzhelev , based on what i did so far and the changes i made, i'm removing all the .rulesets from the projects and maintaining it in the Common.props. With this, i think we dont have any other issue, the ones i found we already solved it. What else should we do? |
I'd suggest we close this one and will create specific issues for concrete proposals on improving code style |
* Initial implementation of OpenTelemetry.Extensions.Owin * Analyzers warnings fixed. * Formatting fixes. * OWIN instrumentation & example project. * README updates. * Re-throw exception. * Unit tests and bug fixes. * dotnet format fixes * MD lint * Warning cleanup + switch to enum for enrich events * MD lint 2 * Added comment about pipeline placement. * Removed the propagator on owin options. * Sealed OwinInstrumentationEventSource. Co-authored-by: Denis Ivanov <[email protected]>
There are concerns about the amount of violations stylecop finds - we should turn it down.
The text was updated successfully, but these errors were encountered: