Wednesday, May 28, 2008

Hudson adds support for StyleCop

Last week Microsoft released StyleCop (aka Microsoft Source Analysis for C#), a tool that analyzes C# code and enforces a certain code style (similar to Checkstyle). The tool will go through all C# source files and mark the code style violations. Now Hudson (a Continuous Integration server) together with the Violations plugin has added support for parsing the StyleCop XML report and display the results for every build.

The Violations plugin displays a trend graph over builds so it is real easy to see that your project is progressing in the right direction (decreasing the number of violations). As you can see the plugin also supports FxCop reports.

Each build will display a listing of the files that are violating the code style, and it is also possible to see the number of fixed (or introduced) violations for every build.

Clicking on a file will display excerpts from the C# code showing the violations.

Follow the guideline here after downloading StyleCop. Add the <Import Project="$(ProgramFiles)\MSBuild\Microsoft\SourceAnalysis\v4.2\Microsoft.SourceAnalysis.targets" /> to every csproj file that you are building within Hudson. When the VS project is built, StyleCop will store a file named StyleCopViolations.xml [Update, if you are using StyleCop 4.2 enter SourceAnalysisViolations.xml in the project folder. As of now, there is no way to store it elsewhere. The XML file contains all violations that were found in the Visual Studio project.

Hudson Configuration
To configure the violations plugin, enable the "Report violations" check box. If there are several VS projects in the build, you should use **/*/SourceAnalysisViolations.xml as it will find XML files in all sub folders.

After configuration, start a new build to analyze and display the StyleCop results in Hudson. To see a trend graph you need at least two successful builds.

  • Do not enable all rules, choose those that are valid for your organization and make sense for you.
  • Do not activate too many rules at first, as it probably will generate too many violations. Too many violations may be ignored by your co-workers, as it seems to be too much work to fix them all. When the most critical code style violations has been fixed, increase the number of rules.


cody said...

Installed plugin and stylecop Added assembly lines to project files.

Verified Hudson Violations V7.1 plugin and Stylecop 4.3 installed correctly.

Violations plugin reports "No reports" after build.

Checked for presence of XML file, should be **/*/SourceAnalysisViolations.xml
according to above link. Actual name of file generated by Stylecop was

Any Suggestion?

redsolo said...

The directory search is case sensitive, so a work around is to enter "**/StyleCopViolations.xml" instead. For more info see

Anonymous said...

How can I disable StyleCop rules? I cannot find some good documentation of StyleCop...

thx martin

Oliver said...

I can't get StyleCop and the violations plugin to work properly.

I'm using StyleCopCmd to output my StyleCop XML report.

I've filed the following bugs relating to my issues:

I was wondering if you had ever had these problems or if you had any suggestions.


Anonymous said...

Using StyleCop and Hudson 1.346, I used the following in my .csproj files to get StyleCop violations and source code linked:

<!-- Causes problems with FxCop and StyleCop violations mixing in some Hudson/StyleCop/MSBuildExtensions version combinations. -->

<StyleCopOutputFile Condition=" '$(StyleCopOutputFile)' == '' ">StyleCopViolations.xml</StyleCopOutputFile> <!-- two sinqle quotes after the == -->
<!-- -->
<Import Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.3\Microsoft.SourceAnalysis.Targets" />

redsolo said...


Could you open an issue on the Hudson issue tracker? Preferably with an xml showing the problem.

buy Cialis said...

this is perfect because C+ has no change in a long time, maybe with this I can analyze some mistakes in the program code, you know to obtain a better performance.

Penis Enlargement Pills said...

Really you have done great job,There are may person searching about that now they will find enough resources by your post.I like this blog..

Generic Viagra Blog said...

It is a great tool, C+ can sometimes, specially if you are tired, very tricky, and you could miss a letter.

tablet pc 10 pulgadas said...

Gosh, there's a lot of helpful information above! said...

A great deal of useful information for me! said...

Quite worthwhile information, thanks for your post.

hcg said...

I have been looking for sites like this for a long time. Thank you!

Cheap SSL said...

This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. - Wildcard SSL

Donanyna said...

The plugin is very useful

saim said...

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.

natural minerals
best naturals
buy curcumin

free flash intros said...

Saying thanks will not just be enough, for the extraordinary lucidity in your writing. I will immediately grab your rss feed to stay privy of any updates

Cheap SSL Certificate said...

It's really informative resource and also you have comprehensive knowledge of blogging. You truly deserve the right skill of blog writing. Thank you so much for sharing it!

Cheap WildCard SSL | Cheap EV SSL Certificate

Taruhan Bola said...

Hrmm that was weird, my comment got eaten. Anyway I wanted to say that it's nice to know that someone else also mentioned this as I had trouble finding the same info elsewhere. This was the first place that told me the answer. Thanks. 338A Sbobet Casino

Judi Bola said...

Great post! I?m just starting out in community management/marketing media and trying to learn how to do it well - resources like this article are incredibly helpful. As our company is based in the US, it?s all a bit new to us. The example above is something that I worry about as well, how to show your own genuine enthusiasm and share the fact that your product is useful in that case. Prediksi Bola Agen Bola Prediksi Bola

Agen Bola Online said...

I have not much time to visit many websites. But today I found this site accidently. I explored much information which is useful to my life. Thanks! Agen Sbobet

sinta dewi said...

Agen Casno Online | Agen Bola Online | Agen Judi Online

sinta dewi said...

Prediksi Bola Zenit VS Sevilla 24 April 2015 |

Anonymous said...

This is really amazing. Such detail!
agen sbobet | heropoker

Anonymous said...

I was looking for more info ;)
agen bola | bola88

Bagus Andy said...

I agree, for the most part, but don’t you feel as if the issue is more complex than that?
scandal video

Gunawan Adhy said...

Really appreciate this wonderful post that you have provided for us.
gambar bokep

Anonymous said...

Thank you for another fantastic posting. Where else could anyone get that kind of information in such a perfect way of writing
Poker Online Indonesia | Situs Judi

Anonymous said...

The you have is very useful.
AlexaVegas | vegas88

taruhan bola said...

This is really amazing. Such detail!
bandar bola | casino online

Pokerace99 said...

Hey there! I could have sworn I’ve been to this website before but after checking through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be bookmarking and checking back frequently!

agen casino indonesia || sbobet casino

Bingung Jeneng said...

I am really thankful to the holder of this website who has shared this wonderful piece of writing at here.

Pokerclub88 || afapoker

Anonymous said...

Thanks for the info, maybe I can use this ended my tufted marketing and
I've been use untold anulus media in run a interaction and they someone existing a big amend on me.
cerita sex || cerita dewasa || blowjob hot

Run 3 said...

Very interesting! Thanks for your sharing
Papa Louie 2

Run 3 | Stick Run 2 |friv4school | girls go games
unblocked games

meto mayo said...

الفك والتركيب والتغليف والتحرك من خلال شركة نقل اثاث بجدة متميزة تحتاج الي ركن البيت للاستفادة من خدماتها التي لا تقدم غير خدمات نقل اثاث بجدة رائعة لتلبية طلبات العميل. فرؤية الشركة لدينا وضعت طريقة جيدة وضعت كخبراء في نقل الخدمات التي يحتاجها العملاء عند التعاون مع شركة نقل عفش بجدة فاختيار المواد الخاصة بك التي تستخدم في تغليف الاثاث فهذه المواد أو الأشياء ستكون موجودة على عتبة المنزل للتحرك بكل آمن و بقوة إلى المكان الذي ترغب فيه
شركة نقل الاثاث بالدمام
استخدام الأصول الأولى داخل الاستراتيجية التي تستخدمها شركة نقل عفش بالدمام لدينا تدفعنا إلى التفكير في إعطاء نوع من الخدمات المتميزة الي العملاء التي تترك نجاحا مباشرا يمكن أن تنقش على نفسية الزبائن التي تقدم لهم خدمة نقل العفش.فلدينا ميل إلى أن يشار جيدا إلى العاملون والفنين والمغلفون ان يقوموا بعملهم في شركة نقل اثاث بالدمام نتيجة للمعيار والتنمية والعقل
شركة نقل الاثاث بمكة
مجموعة معينة لدينا في شركة نقل عفش بمكة تساعدنا في خدمتك في أي وقت من اليوم، وأنهم على استعداد للبقاء على طول هذه الخطوط لاعطاءك خدمة متميزة عن باقي شركات نقل اثاث بمكة التي توجد بهذه المنطقة فلا أحد لدينا في خدمات النقل يترك شيئا حتي لا نقع في قليلا من السخط.
شركة تخزين الاثاث بالرياض
التعبئة والتغليف يبدأ بالعمل المتميز من اجل الحصول علي شركة تخزين عفش بالرياض متميزة تمتلك مستودعات تخزين اثاث بالرياض تحافظ علي الممتلكات الخاصة بكم من الخراب. كما ان التعبئة والتغليف على استعداد فريد للتعامل مع كل نوع من الأدوات والأشياء الزجاجية والمواد التي تميل إلى الإضرار أو تحمل بانتظام أسوأ جزء في عملية الحركة. فخدمات شركة تخزين اثاث بالرياض تقوم بإرسال أفضل مجموعة يتقن الوصول إليها في الوقت المناسب لتلبية طلب العميل وفقا لمتطلبات محددة خاصة بك في هذا المجال بسبب الطريقة التي كانت لدينا مجموعة من الخبراء في كيفية ادارة مستودعات تخزين اثاث منذ فترة طويلة في هذه الصناعة لفترة طويلة جدا.
شركة تخزين اثاث
شركة تخزين عفش