June 4th, 2008 — Gendarme
Google Summer of Code started the previous week, I can’t believe I haven’t blogged anything yet about the topic.
Let me talk a little about me, my name is Néstor Salceda and I’m studying Computer Science and, perhaps, someone will known me yet because this is my second year as student in the Summer of Code, the first year was wonderful and I decided apply other time
This year, my goal is to enhace Gendarme in order to be more useful to the Mono Project itself. For achieving this goal I have identified 4 key tasks:
- Apply the existing rules.
- Write new rules, putting special effort in write useful rules for implementing the class libraries.
- Apply the new rules to the class libraries.
- Automated Gendarme Reports generation and publication.
And finally, good luck for all students, and thanks to Mono Project for the opportunity 
April 27th, 2008 — Gendarme
Well, I’m proud to say that the first edition of the Gendarme Rule Day has been a great experience and it ended successfully.
Also give a big thank to all people that was yesterday in the IRC with us (you rocks dudes!). Thanks for your time, thanks for your ideas, thanks for your presence, thanks for the thanks, thanks for the laughings … thanks for all.
Numbers:
In this edition, if my review doesn’t fail, we have 10 more rules and 3 nice enhacements to existing rules. And a lot of new ideas for great features. And also we have new friends and 2 new rule makers: Cedric Vivier and Andrés.
Next steps:
Well, by myself, I should start finishing several tasks I had started in the past:
- Gendarme and NAnt integration
- Message Chains Smell
- A new way to express custom parameters to the rules in the XML file
And for finishing, I’m proud of being part of the Gendarme Team, thanks mates for the reminders, thanks for your help planning, giving nice tips, staying there and writting new rules. All I can to say is that we can’t stop rocking
April 16th, 2008 — Gendarme
The Gendarme team is proud to announce the first edition of the Gendarme Rule Day.
- If you have a nice idea for a rule which you’d like to write or discuss.
- Or if you don’t have a specific idea but you’d like to try Gendarme and write a new rule.
- Or if you’d like improve an existing rule.
- Or if you want to learn more about Gendarme ecosystem or Gendarme developer’s and fans …
Please join us April 26th in the #gendarme IRC channel (in irc.gimp.org) for an interactive, collaborative and intense rule writing effort.
We will be there with you!
March 1st, 2008 — Gendarme
Yesterday night, before a week without any free time, I decided spent some time on Gendarme.
I decided spent some time on integration tasks with others applications (NAnt, XBuild, CC.NET …) You can read the thread on Gendarme Google Group. And I started writting a Gendarme Task for NAnt.
By the moment, as I can’t capture all in an screenshot, you can see it in action in a screencast: Gendarme and NAnt
Note that it’s only a prototype, and is under heavy development and it’s far away to be a usable stuff (by the moment).
January 17th, 2008 — Gendarme
In the Mono Summit the Gendarme Team discussed about the features for the next version. We have a lot of new ideas for improve the framework. The main targets, for the framework, are the following:
- Make simpler write rules, and easier to understand.
- Make rules uniform, reduce code duplication, easy testing.
These topics are a bit abstract and is a hard task get it completed. But I believe this is the first step for achieve these topics.
The main problem when we are writting new rules, is the code duplication. There are several things we should prepare before write the rule logic. By example, when a rule is applied? We have a lot of scenarios before appliying the rule, if the method is anonymous doesn’t make sense check about the naming conventions, or if a rule must check only the setters. And is always the same code, repeated one time, other time, another time …
It’s easy to understand that this code should be extracted to other class but, where should we put this code? The first impression was create static helpers classes, then you can get this code in the rules:
public MessageCollection CheckMethod (...)
{
if (!MethodHelpers.IsSetter (method))
return runner.RuleSuccess;
//Imagine more rule logic
}
It’s okey, but if we use static classes with static methods and thinking a bit … Eureka! We can use extension methods to Cecil types, following the JB’s Mono.Rocks, and the rules looks like:
public MessageCollection CheckMethod (...)
{
if (!method.IsSetter ())
return runner.RuleSuccess;
//Imagine more rule logic
}
Beautiful code, isn’t it?
Then, Sebastien and GHOP participants (Daniel Abramov, Adrian Tsai and Andreas Noever) implemented some of these Rocks (Good work guys !). The Rocks have unit tests and documentation, and we can use it for concentrate our effort writting more complete rules (click the image for a bigger size).
Finally, as all people loves screenshots, this is one screenshot of Monodoc showing the rocks documentation:

December 4th, 2007 — Gendarme
Wonderful, incredible, fantastic, amazing… I haven’t enough words for describing my first Mono Summit.
The first day, I was really excited and a bit nervous because I didn’t know anyone, but quickly I found Sebastien and JB and I sat by them (thanks you for all guys!) and we started talking, and hacking.
I also can see other people from the Mono-Hispano community (Andres, Carlos, Juan Ramon …) but I missed Marcos a mate from the GSoC, I didn’t meet you, but I hope the next time we will meet.
All talks also was really interesting: MonoDevelop, NUnit, Boo, Db4o, C# 3.0, Moonlight, Build Service, Boxerp, Debugger …
Summarizing, the best: all the people. Thanks you very much!
Finally the last day, we discussed the new features for the next Gendarme release, you can see it here. There are some killer features and a lot of new ideas.
November 22nd, 2007 — Gendarme
Since the last post talking about the project files for MonoDevelop, there are some progress that should be mentioned:
And the next week is the Mono Summit 2007. I’m really excited, because I have the chance to meet face of face to all the Mono Team (and my Gendarme colleagues), I can talk with them, I can learn a lot of things from them, improve and perhaps hack together.
October 9th, 2007 — Gendarme
This last week, we have been improving the build system and updating the project files for MonoDevelop and Visual Studio. This means, that you can use MonoDevelop or VS for explore the project and also for writting new rules. However this improvement is still under heavy development, you can see an screenshot:

Sebastien has merged more rules from the GSoC 2007 (from Nidhi and Lukasz).
October 2nd, 2007 — Gendarme
Well, since the Pencils Down Report for the Summer of Code I haven’t written anything about Gendarme. I have continued contributing, as I wished, and there’s time for write a bit about the progress.
The rules for my GSoC has been merged, and there are more improvements:
- Install Gendarme.Framework.dll to be reusable with new runners and pkg-config.
- Support inclusion and exclusion of rules.
- Added a new profile.
Step by step, the first feature allows developers to compile their runners with the -pkg:gendarme-framework modifiers to [g]mcs.
The second one, allows users to create their custom rulesets and adapt the existing ones to their needs. By example: Imagine a company that uses Gendarme to check their code. Then they can choose the rules that they apply.
If, by example, you like check the CodeDuplicatedInSameClass smell and AvoidLongMethods smell, but you doesn’t like apply the AvoidSpeculativeGenerality you could do it simply:
< ruleset name="custom" >
< include ="CodeDuplicatedInSameClassRule | AvoidLongMethodsRule" from="Gendarme.Rules.Smells.dll" />
< /ruleset >
And the third one, is the Mono BCL profile. This profile is intended to use with applications or libraries where the public API isn’t under our control, by example Mono.
August 21st, 2007 — Gendarme
Sadly, the Summer of Code 2007 has (quasi) finished. This is the time for fill the surveys and check the code.
Personally I have enjoyed a lot contributing with this project and I would like continue contributing with this project, there are some work to do and a lot of rules for implement and I would like continue working in this area.
A briefly summary of my contributions:
- A rule for don’t swallow errors catching non-specific exceptions.
- A rule for check that Attributes end with Attribute suffix.
- A rule for check that enums doesn’t end with enum or flags suffix.
- A rule for check that a enum flags uses a plural name.
- A rule for check that a enum uses a singular name unless are flags rule.
- A rule for check for unused parameters.
- Two rule for check that doesn’t exist code duplicated.
- A rule for check the class length.
- A rule for check the methods length.
- A rule for check long parameters list.
- A rule for check the presence of speculative generality.
- A little gui for a cecil based tool for count and get some numbers for the classes: Number of methods, number of fields, number of lines per method …
- A patch for gendarme for allow set properties in the rules.xml file.
- A little patch for Cecil.FlowAnalysis for allow try - catch -finally blocks in the flow analysis.
Then, I have learnt a lot of stuff: I have learnt about FOSS projects, how these projects works, I have learnt about Cecil and Gendarme, I have learnt C# and CIL, it’s amazing.
I want thank all people that helped me, specially Sebastien, my mentor, for his patience everyday, his coding lessons, his help, his comments … I also want thank all people that has helped me, Alan, Chris, JB Evain, and my colleagues working on more Gendarme stuff, Nidhi and Lukasz. And I’m sure that I will forget some names, please apologize me. Thanks to all.
And finally, thanks to the mono project for accept my application and to Google for the Summer of Code.