Gendarme rule to review attributes on rules
completed by: Yuri Stuken
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.
The task is to write a Gendarme rule that ensure attributes are correctly used (or avoided) on rules. This rule must cover the following attributes.
* [Problem] and [Solution]: only to be used on rules, the string argument must not be null or empty. All concrete rules must have them (or inherit them from an abstract rule).
* [FxCopCompatibility]: used only on rule, both arguments can be checked (non null, non empty, AA9999 id format)
* [EngineDependency]: used only on rule, the argument type must inherit from IEngine.
* [DocumentationUri]: used only on rule (note: there's already a rule that will check the argument is valid);
* [Description] and [DefaultValue]: used only on rules public properties. [Description] argument must not be empty.
To complete the task the student must provide:
* the rules, written in C#. The source code must follow the Mono source code guidelines (available at http://www.mono-project.com/Coding_Guidelines). Also a 'self-check' must be done one the code (i.e. you need to run gendarme on your own code) and the defects, if any, must be fixed (in doubt please ask for guidance on IRC).
* its documentation (in-source xmldoc) that includes 'good' and 'bad' examples; and
* the unit tests (also in C# using the gendarme helpers around NUnit) proving the rule is working as intended
* a patch to fix all such issues (if any) in Gendarme rules
Once ready the files (or the patch) can be submitted to the mentor for review.
* In order to avoid misunderstandings you should start by writing your unit tests and ask for a review of them. That will quickly tell you if you're on the right path to solve the problem.
* Gendarme provides hundreds of rules that can be used as example, here's one
* Gendarme web site: http://www.mono-project.com/Gendarme
* Mailing-list / discussions: http://groups.google.com/group/gendarme
* IRC: #gendarme on GimpNET