Friday, September 25, 2009

DevTnT 13 – StyleCop

Most people agree that having a consistent coding style throughout a solution is beneficial to the development process.  In the past it has been difficult to enforce a style, though.  StyleCop is one answer to that problem.

StyleCop – the tool formerly known as Source Analysis – is a tool that analyzes C# code and warns about violations against “a common set of best practices for layout, readability, maintainability, and documentation of C# source code.” It can be run from inside Visual Studio, and can also be integrated into MSBuild scripts.

When run inside Visual Studio, StyleCop integrates with the Error List tool window, and double-clicking on a warning will take you to the appropriate spot in your source files.

stylecop

It is possible to configure which rules StyleCop should check, however it is not possible (yet) to modify existing rules or define your own rules.

StyleCop can also be used as part of your build process using the out-of-the-box MSBuild integration.

No comments:

Post a Comment