GSoC/GCI Archive
Google Code-in 2010 Mono Project

Apply Gendarme on all Gendarme.Rules.Interoperability.Com rules

completed by: Nick Rioux

mentors: spouliot

Background

Gendarme is a static analysis tool to find problems in .NET software. Gendarme inspects executables and libraries that contain code in ECMA CIL format (Mono and .NET) and looks for common problems with the code, problems that compiler do not typically check or have not historically checked.

 

Task

Iteratively fix all defects that Gendarme finds on all rules inside Gendarme.Rules.Interoperability.Com. This includes (not an exhaustive list) the following defects:

AvoidComplexMethodsRule
AvoidLongMethodsRule
AvoidRedundancyInTypeNameRule
AvoidRefAndOutParametersRule
AvoidRepetitiveCallsToPropertiesRule
AvoidUnnecessarySpecializationRule
MethodCanBeMadeStaticRule
VariableNamesShouldNotMatchFieldNamesRule

 

Hints

* The goal is not to hide the defects (e.g. find a way that gendarme won't report it). If a method is too complex then the fix is not simply to break it in two. The complex method should refactored into *less* complex method(s), i.e. from complex to simple ;-)

* Some defects cannot be fixed (e.g. the solution can be worse than the original defect even if gendarme does not complain about it). In those (rare) cases a new entry in 'self-test.ignore' should be added and include a comment as to why it's better ignored (than fixed). But better check on IRC before doing so!

 

Resources

* Gendarme web site: http://www.mono-project.com/Gendarme

* Mailing-list / discussions: http://groups.google.com/group/gendarme

* IRC: #gendarme on GimpNET