StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.85k stars 1.5k forks source link

Naming inconventions on private fields. #2648

Open meokullu opened 4 months ago

meokullu commented 4 months ago

Under test, I see private fields don't start with underscores.

image

Is there any specific policy to avoid using underscore before letters on private fields by Redis? I would like to change them all, on entire solution but I wanted to create an issue to be sure about it.

Here is Microsoft's link about indentifier names. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names

mgravell commented 4 months ago

That particular example is the long-obsolete redis-sharp, only retained for backwards tests. It's "grandfathered", effectively.

However, your point is valid. If we don't already have an editorconfig rule for this, we should probably add one. I usually try to avoid purely cosmetic things, though, or at least group them together to minimise PR invalidation.

meokullu commented 4 months ago

Well, even though I added only one example to ask it, I have seen multiple examples under Tests. Also, when I did a search now, I see same usage under source files too.

To create consistency about field naming, if it helps to anyone to use somehow better or investigate any kinds of improvements better, with your approval I would like to change them into _privateField style.

With naming consistency, I want to add my article named "consistency check", even though there are many mechanism to prevent instant mistakes, creating a consistency could be benefitical in long term. However, it is your call. It just got my attention. https://medium.com/@enesokullu/consistency-check-daddda2f6a9

image

image