Gendarme
From Mono
Gendarme is a extensible rule-based tool to find problems in .NET applications and libraries. Gendarme inspects programs 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.
Gendarme uses the Cecil library to introspect code.
| Table of contents |
Why ?
- Because we often repeat our mistakes. The biggest one being not to review things we know;
- Because it's a lot funnier (and safer) to write a rule than to review millions of SLOC to ensure it's being followed.
History
Gendarme was originally created by Sebastien Pouliot to assist in the security auditing process in Mono. Aaron Tomb later integrated his .NET bug-finding code (supported by the 2005 Google Summer of Code, GSoC) into the same framework. Since then the number of contributors (http://anonsvn.mono-project.com/source/trunk/mono-tools/gendarme/AUTHORS) and rules has been growing.
Gendarme tasks has proven popular in GSoC (http://code.google.com/soc/2007/) (three projects in 2007) and the new Google Highly Open Participation (http://code.google.com/opensource/ghop/2007-8/) (GHOP) with 17 taskes (40 rules) for the first edition (2007/2008).
Runners
Console
A console-based runner is available to use Gendarme and it's rule on your own code. It is capable to output it's results directly on the console, into XML files or into nice looking HTML reports.
man gendarme
will provide help about all options available from the console runner.
Wizard
A GUI (System.Windows.Forms) runner is now part of Gendarme distribution. This is a simple, wizard-based, runner that allows you to select assemblies, rules and report the analysis results just like the console runner does (text, xml or html reports).
Other runners
A few other runner exists, like GendarmeAddIn (http://code.google.com/p/gendarmeaddin/) for MonoDevelop (http://www.monodevelop.org) and a SWF-based runner from GSoC 2007, or are in development. Feel free to contribute GUI-based runners (e.g. GtkSharp, CocoaSharp...) and plug-in based runners (e.g. for VS.NET).
Framework
The current Gendarme framework, Gendarme.Framework.dll, is a work in progress. It will probably change a lot before 1.0 is released. It's main goal is to make it easier to write and test rules.
The current Gendarme framework, Gendarme.Framework.dll, is a work in progress. It's main goal is to make it easier to write and test rules. It requires a C# 3 compliant compiler to compile properly (it works with Mono from SVN and with VS.NET 2008).
At this stage we're not committed to a final API, so things may still change a lot before version 1.0 is released.
Rules
Gendarme is modular and load all of it's rules from assemblies (i.e. there are no default rules). For the console runner the list of loaded rules assemblies is defined in the rules.xml configuration file and can be adapted to different needs (e.g. project specific rules).
Current rules are divided into the following categories/assemblies:
- Gendarme.Rules.BadPractice
- Gendarme.Rules.Concurrency
- Gendarme.Rules.Correctness
- Gendarme.Rules.Design
- Gendarme.Rules.Exceptions
- Gendarme.Rules.Interoperability
- Gendarme.Rules.Naming
- Gendarme.Rules.Performance
- Gendarme.Rules.Portability
- Gendarme.Rules.Security
- Gendarme.Rules.Serialization
- Gendarme.Rules.Smells
- Gendarme.Rules.Ui
Helping!
You can follow the Gendarme's development discussions on it's Google Group (http://groups.google.com/group/gendarme). This is also where you'll find the roadmap (http://groups.google.com/group/gendarme/web/roadmap) to the future versions, (wish)list of todo, rules (http://groups.google.com/group/gendarme/web/rules) proposal and developer documentation (http://groups.google.com/group/gendarme/web/how-to-write-cool-rules). Gendarme's developers are also IRC (#gendarme on GIMPnet).
Availability
Source code is available from SVN (http://anonsvn.mono-project.com/source/trunk/mono-tools/gendarme/) (tarball (http://anonsvn.mono-project.com/viewcvs/trunk/mono-tools/gendarme.tar.gz?view=tar)). Since Mono 1.9.0 Gendarme is part of mono-tools and is probably available for your distro (if recent) or from openSUSE Build Service (http://software.opensuse.org/search?baseproject=ALL&p=1&q=mono-tools). For Windows users we now have an experimental installer available in the Gendarme Google Group (http://groups.google.com/group/gendarme/files).
Feedback
Please report any documentation errors, typos or suggestions to the Gendarme Google Group (http://groups.google.com/group/gendarme). Thanks!

Powered by MediaWiki