Instant StyleCop Code Analysis How-to by Franck LEVEQUE - A Book Review

The very nice people at PACKT Publication recently asked me to write a review of their new book StyleCop Code Analysis, and you know I never miss the changes to learn things when it is for free J. Yes you heard it right, I received this book from publisher for free.


As the title says, this book is intended to provide the instant basic knowledge required to get started in StyleCop and its tools. If you are already using StyleCop and want a more in-depth knowledge, last 2-3 recipe will help you. So, in addition to begin with StyleCop, this book also visits the current available tools used by developers. This includes Resharper, Dev Express – Code Rush, Code Maid, NArrange. You will see this book addressing things for C# programmers using Visual Studio 2008, 2010 and 2012 IDE as well as MSBuild Engine and teaches you how to automate StyleCop using MSBuild and much more.

Overview Of The Recipes/Chapters

Installing StyleCop with Visual Studio (Simple)

This recipe describes the installation process of StyleCop, how to configure the rules to be executed on a project, and how to launch an analysis from Visual Studio.

Understanding the Resharper add-in (Simple)

This recipe will discover the StyleCop add-in for Resharper. You will see its real-time analysis and how to easily fix most of the StyleCop violations.

Automating StyleCop using MSBuild (Simple)

This recipe describes how to automate build process using MSBuild. Also describes which lines need to be added to the MSBuild project in order to enable StyleCop analysis and how to cap the number of violations encountered before the build breaks.

Automating StyleCop using a command-line batch (Simple)

In this recipe you will learn how to analyze your projects with StyleCop from the command line. For this, you will see a tool named StyleCopCmd being used, and prepare it to be able to launch the last version of StyleCop.

Automating StyleCop using NAnt (Intermediate)

This recipe will teach you how to use StyleCopCmd to automate our process using NAnt.

Integrating StyleCop analysis results in Jenkins/Hudson (Intermediate)

This recipe describes how to build and display StyleCop errors in Jenkins/Hudson jobs. To do so, you will learn how to configure the Jenkins job with a full analysis of the C# files in order to display the technical debt of the project. You will also set in the job an automatic recording of the last number of violations. Finally, you will return an error if you add any violations when compared to the previous build.

Customizing file headers (Simple)

In this recipe you will see how to customize file headers to avoid StyleCop violations, and how one can use Visual Studio templates and snippets to make life easier while developing.

Creating custom rules (Intermediate)

This recipe teaches you how to create own custom rules for the StyleCop engine. Also, how to add parameters to this rule.

Integrating StyleCop in your own tool (Advanced)

In this recipe you will see how to embed StyleCop with your own tools. As an example, you will learn by creating a real-time analysis add-in for MonoDevelop/Xamarin Studio.

My Thoughts

This book will be a great companion as you read and at the same time try it in your favorite IDE. In the starting of the book, few basic thing are explained nicely including StyleCop installation and use of Reshaper with StyleCop. One thing I would like suggest the publisher and author to cover in the next print, add more examples on how to fix most of the StyleCop violations in projects, use screenshots for this. I think this would add great value to the Book, if author wishing to target more C# people (world’s most used PL I think).

Comments

Popular posts from this blog