StyleCop - OrderOfThePorcupine/ProjectPorcupine GitHub Wiki
StyleCop analyzes C# source code to enforce a set of style and consistency rules. It has many benefits.
- It can be checked automatically. With any other style, you have to be a "human style cop" every time you review a pull request. This is boring.
- With any other style, there is always a gray area that's discussed endlessly. This is boring. A line according to StyleCop is either good or bad, nothing else.
- Rules that we find are too rigid can be turned off, it's not an all or nothing deal.
To install:
Visual Studio
StyleCop appears to be included in Visual Studio 2015 Express by default. But in case you dont have it:
- In the menu bar click Tools and then Extensions and updates....
- Click Online.
- In the search box in the upper right type StyleCop.
- Select Visual StyleCop and click Download.
MonoDevelop/Vs for mac
- In the menu bar click Tools (or MonoDevelop-Unity on MacOS) and then Add-in Manager.
- Click Gallery.
- In the search box in the upper right type StyleCop.
- Should be one hit, select it and click Install.
Elsewhere
You can use this script to command line run it.
To Run
Visual Studio
- In the menu bar click Tools.
- Click Run StyleCop (Ctrl+Shift+Y).
- Errors are presented as compiler warnings.
- Run like this it scans the entire project.
- You can also start it by right clicking a file in the solution explorer to run on just that file.
MonoDevelop
- In the menu bar click Tools.
- Click Run StyleCop.
- Errors are highlighted in your current file, if any.
- Errors are also presented as compiler warnings.
- Run like this it scans the entire project.
- You can also start it by right clicking a file tab to run on just that file.