StyleCop is an open source static code analysis tool* that enable you to enforce a set of style and consistency rules under a subset of Microsoft's .NET Framework Design Guidelines.
StyleCop works by analyzing the source code, and allows it to enforce a different set of rules from FxCop, which, (instead of source code) checks .NET managed code assemblies.
The rules are classified into the following categories:
- Documentation.
- Layout.
- Maintainability.
- Naming.
- Ordering.
- Readability.
- Spacing.
StyleCop is visualised by open any project of C# and right clicking on the project. From here you should be able to view two menus in the project; one helps select the rules, and the other runs these rules on the C# project.
The tool can be run from inside of Visual Studio or it can be integrated into an MSBuild project. StyleCop has also been integrated into numerous third-party development tools as well.
*StyleCop includes both GUI and command line versions of the tool.