If I would like a rule to execute, but I know that it incorrectly
makes a finding for a given method.
Is there a way for me to decorate the method with some attribute
(example follows)?
[IgnoreGendarmeRule(EnsureLocalDisposableRule] // foo is Disposed
elsewhere in method Bar ()
void DoStuff ()
{
IDisposable foo = new Foo ();
DoSomeStuff (foo);
On Mon, 2009-11-02 at 12:18 -0800, Vlad wrote: > Hi,
> If I would like a rule to execute, but I know that it incorrectly > makes a finding for a given method. > Is there a way for me to decorate the method with some attribute > (example follows)?
> [IgnoreGendarmeRule(EnsureLocalDisposableRule] // foo is Disposed > elsewhere in method Bar () > void DoStuff () > { > IDisposable foo = new Foo (); > DoSomeStuff (foo); > }
At some point we'll support the [SuppressMessage] attribute that MS use to ignore defects with FxCop. About 50% of the code is already there.
In the mean time the solution (which, personally, I much prefer to using attributes) is to use an ignore file, see example in [1], docs in [2].
For 2.8 I plan to write a tool to convert defects into ignore entries. That will make it easier for people who want to create a baseline on existing software.