Saturday, May 31, 2008

Source Code Analysis for C# - StyleCop

Microsoft released the tool for source code analysis for C#.Currently MS developed this only for C# not for VB. Microsoft using this for their internal purpose also. They have named this as "StyleCop". Earlier, MS released the tool called "FxCop" that analyse the compiled binaries but "StyleCop" analyse the source code. It provides the set of rules for style, documentation ,readability, etc. Currently they have defined around 200 rules. Those rules are not Customizable.But you switch ON/OFF the rules depending on your needs or company standard.

They have covered the following catagory rules:

1. Documentation
2. Layout
3. Maintainability
4. Naming
5. Ordering
6. Readability
7. Spacing

Screenshot of rules in StyleCop:

Screenshot of using this tool in application:

The ultimate goal of the source code analysis tool is allow you to give clean , consistant code with team members and for others who view your code with more readability.

Click here to download the Source Code Analysis Tool