StyleCop analyzes C# source code to enforce a set of style and consistency rules.
StyleCop analyzes C# source code to enforce a set of style and consistency rules.
Customer Reviews
Oleksandr V.
Advanced user of StyleCopI always use StyleCop on all my C# projects.
It has a lot of predefined rules that you can use with your projects.
It has settings which you can use to turn on or turn off settings.
I have already created setting file which I use on all projects from the very beginning. As a result - all projects are developed with the same style, same experience.
StyleCop team added Roslyn analyzer a few years ago. It became even easier to use StyleCop since it is run during compilation.
All violations are shown as a build warnings.
You can create your own StyleCop rules and include it to the project.
StyleCop could be used in Visual Studio on Windows only before Roslyn analyzer was released.
There are many ways how to suppress violation (and it is good from one point of view), and different developers use different ways to do that. I would like to have a possibility to limit devs in how they can suppress messages (and also to force them to write suppress message)
Learn about StyleCop (and how to use it as Roslyn analyzer). Read existing rules. Define the set of rules you are going to use on your projects. Use this file fo every new project.
Create your own rules when you need something extra expect for the standard rules
I use StyleCop to define code style on a project, so every developer codes in the same style (like required spacing in indentation, new lines, curly braces, commenting, etc.)