StyleCop

Microsoft has released StyleCop 4.3 to the developers. StyleCop is a source code analysis tool for the C# programming language. It has been used at Microsoft internally for many years. The tool enforces the best practices in source code. It is similar to another tool from Microsoft called FxCop. However StyleCop works on source code, while FxCop works on binary files.

StyleCop does not focus on the design of code. Instead it focuses on the layout, readability, and documentation in the code. The overall goal is to produce code that others can easily read. The rules which the tool enforces cannot be easily configured. The tool implements around 200 best practices in the code. Some of these are location of brackets, spacing, ordering of elements, and variable naming. The tool can be run within the Visual Studio IDE. It can also be integrated with builds.

There was a lot of interesting feedback to the release of StyleCop. Many people including myself were interested in a tool like this for other programming languages. There is also a great desire to disable and configure the rules enforced by the tool. Users have commented that some of the rules are just plain silly. The VS Law program performs a similar function for Visual Basic code. Some developers worried that this tool would be used by control freaks for evil purposes.

Unfortunately we code almost exclusively in C++ on my current project. So StyleCop would not be of much use. However we try to cover best practices when doing peer reviews. It would be nice it we could delegate that task to a tool such as StyleCop. Come on Microsoft. Hook us up.