Skip to content

Gendarme.Rules.Gendarme.DefectsMustBeReportedRule(git)

Sebastien Pouliot edited this page Mar 2, 2011 · 1 revision

DefectsMustBeReportedRule

Assembly: Gendarme.Rules.Gendarme
Version: git

Description

This rule checks if at least one method in types implementing IRule is calling Runner.Report.

Examples

Bad example:

public class BadRule : Rule, ITypeRule
{
    public RuleResult CheckType (TypeDefinition type)
    {
        return RuleResult.Failure;
    }
}

Good example:

public class BadRule : Rule, ITypeRule
{
    public RuleResult CheckType (TypeDefinition type)
    {
        Runner.Report(type, Severity.Low, Confidence.Total);
        return RuleResult.Failure;
    }
}

Notes

  • This rule checks if Runner.Report is called directly anywhere in rules' methods but it does not check if it being called in the base type or somewhere else, so some false positives are possible.

Source code

You can browse the latest source code of this rule on github.com

Clone this wiki locally