R – StyleCop, advantages/disadvantages


Is StyleCop useful, what are the advantages or disadvantages of it?

I have also downloaded StyleCop, Resharper StyleCop.

I am using resharper and it has its own coding standards and StyleCop has its own, I am confused which rules will be used?

Best Solution

I find StyleCop very useful to get consistency across a development team. It’s not going to improve the functional value of your code but it will improve legibility and remove a lot of the nuances you get in a collaborative environment.

As for having a lot of rules that are not applicable, I’ve found the best approach is just to turn off the ones you don’t want to follow at the machine level. You can then always share this configuration file with others in order to get the whole team working to the same set of rules.

As for ReSharper, there’s some crossover in the rules but it’s primary purpose is coding productivity as opposed to compliance to a set of formatting rules. The other thing is ReSharper is an IDE only tool whereas StyleCop can be used with msbuild outside of Visual Studio. Both ReSharper and StyleCop rule violations will be shown by default so you’ll just need to be selective in terms of which ones you want to adhere to and which ones you want to disable.

Good luck!