StyleCop
Home Page
Categories: Code analysis - Standards verifiers
Author: Microsoft
Latest version: 4.4
Added 2008-05-23Updated 2010-07-26
StyleCop, also known as Source Analysis, analyzes C# source code to enforce a set of best practice style and consistency rules.
Source Analysis is similar in many ways to FxCop, but FxCop performs its analysis on compiled binaries, while Source Analysis analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while Source Analysis focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.
Source Analysis comes with a set of default rules analyzers covering approximately 200 best practice rules. These rules are full compatible with the default layout settings in Visual Studio 2005 and Visual Studio 2008.
Specifically, these rules cover the following, in no particular order:
- Layout of elements, statements, expressions, and query clauses
- Placement of curly brackets, parenthesis, square brackets, etc
- Spacing around keywords and operator symbols
- Line spacing
- Placement of method parameters within method declarations or method calls
- Standard ordering of elements within a class
- Formatting of documentation within element headers and file headers
- Naming of elements, fields and variables
- Use of the built-in types
- Use of access modifiers
- Allowed contents of files
- Debugging text
After installation, Source Analysis can be run from within the Visual Studio IDE, and can also be integrated into MSBuild-based command line builds.
 Built for .NET 2 |
 Built for .NET 4 |
 Add-in |
 Free or free version available |