Table of Contents
1.1 Is Gendarme a C# source checking tool ?
1.2 Which versions of the .NET framework are supported ?
General
Is Gendarme a C# source checking tool ?
Not directly. Gendarme does not work on source code but on compiled assemblies. Once compiled (into Intermediate Language, IL) C# code looks identical to any other (compiled) .NET language. Hence Gendarme is a .NET static assembly analyzer and is not language specific.
Which versions of the .NET framework are supported ?
For analysis Gendarme can process any .NET assembly (that Cecil can read), back to the original 1.0 if you need. Rules are smart enough to disable themselves if the runtime targeted by the analyzed assembly does not support the feature under scrutiny (i.e. there is no performance degradation to use every rule versus a set of 1.x rules).
However in order to execute Gendarme you'll need either Mono (same version) or the .NET framework 3.5 since Gendarme use some recent (C# 3) features such as LINQ.
Usage
When should I use Gendarme ?
Some of Gendarme's rules are better suited in early stage of projects (e.g. design rules). Others can be useful anytime (e.g. bad practice) and some are better suited when the project is stable enough to be released. So you'll gain more if you start using Gendarme early but you can still benefit from it anytime.
I maintain of old code base. Is it too late to start using Gendarme ?
No, but at this stage you might want to consider using a subset of the rules that won't break binary compatibility of your assemblies.
Features
Do I need debugging symbols to use Gendarme ?
No, debugging symbols are not required to use Gendarme. The most useful aspect of debugging symbols is that, when available, reports can include the source file and line numbers (when applicable) for defects found during the analysis.
A few rules (e.g. RemoveUnusedLocalVariables) might turn themselves off if debugging symbols are not available. Others will use the extra information provided (e.g. variable names) and, in a few cases, it could also affect the number of false positives.
Which symbols format are supported ?
Gendarme will read and use the MDB (mono debug) format when available (either when executed on Mono or MS runtime). The PDB (MS debug) format can also be used when executed on the MS runtime. The format selection and loading of symbols is transparent to Gendarme's end users.
Rules
What are rules
Basically a rule is a piece of code that a runner executes over a set of assemblies in order to find some potential defects. Rules are grouped together in assemblies that perform similar analysis (e.g. performance rules).
Rule X checks for something that can't happen using C#
Some rules (e.g. FinalizersShouldCallBaseClassFinalizerRule) checks for condition that cannot occurs in C# (and/or other languages) compiled assemblies. However if this condition can occurs by using IL, either directly (assembler) or indirectly (generated code), or by using some other .NET languages then the rule is still useful in Gendarme. In other words C# != .NET :-)
Results
Can I reduce false positives ?
Yes. The first and easiest way applies to MS compilers users (at least CSC). When used without /o (optimize) the compilers can emit very ugly (but still legal) IL. This includes additional variables (that can be reported as unused), unneeded cast (also reported as defects) and complex branches that can be misinterpreted.
The second way is to ignore some results.This can be done using ignore lists (see example (http://anonsvn.mono-project.com/viewvc/trunk/mono-tools/gendarme/self-test.ignore?view=markup)) and used with the console runner (--ignore ignore-file). It's also possible to filter defects based on their severity (--severity=*) and confidence levels (--confidence=*).