Search code examples
c#.netresharpercoding-stylestylecop

How to deal with Conflicting coding conventions?


Generally we use various static code analysis tools to analyze our code for validation. But I've seen some conflicting scenarios.

As an example if we use class variables, the StyleCop will suggest us to use

this.Name = myName

instead of,

Name = myName

But this will pop up a Resharper error, "Redundant qualifier" and will suggest to not to use "this." notation.

So in such scenarios I need to check a more consistent reference to choose what is correct/Best. Is there any such resource that "defines" the correct conventions?


Solution

  • There is no correct convention, you adopt the one you prefer and that is your baseline/reference.

    if you use both ReSharper and StyleCop you should set them up to work together meaning to accept and validate code in the same way.