C# Rule: Methods and properties should be named in camel case


(Vish S.) #1

SQ Version 6.1 - LGPL v3 - Community
As per this C# rule :
Noncompliant Code Example
public int doSomething(){…}

should be refactored into:
public int DoSomething(){…}

But compliant solution doesn’t seems to be correct as its Pascal Case example.
Also as per the Microsoft recommendation, Class, Method , Properties should be in PascalCase where as method parameters should be in camelCase ,

Can you please verify and let us know if the issues detected can be marked as false +ves accordingly?


(Amaury Levé) #2

Hi @sontakke.vishal,

It’s usually easier for us to find the rule you are referring to when you mention the rule ID.

Your comment is right and we fixed that on the last release of the C# plugin. Note that the behavior of the analyzer was correct, only the spec was wrong.

Cheers,
Amaury


(Vish S.) #4

Thanks for the response Amaury,
Rule ID :csharpsquid:S100
I see the same rule description on below link:
https://rules.sonarsource.com/csharp/type/Code%20Smell/RSPEC-100


(Amaury Levé) #5

Yes you are right, the update wasn’t yet deployed on the rules website as the functional release of the version 7.8 is not yet done (this should happen in the next days).


(Amaury Levé) #6

@sontakke.vishal,

The fix is now deployed.

Cheers