On Sat, 2011-01-22 at 18:40 +0100, "Andrés G. Aragoneses" wrote:
> On 22/01/11 17:45, Sebastien Pouliot wrote:
> > On Sat, 2011-01-22 at 10:21 -0500, Sebastien Pouliot wrote:
> >> On Sat, 2011-01-22 at 15:32 +0100, "Andrés G. Aragoneses" wrote:
> >>> Hello,
> >>>
> >>> I think I've spotted some false positives in EnsureLocalDisposalRule. If
> >>> the IDisposable object detected by the rule is sent out of the scope of
> >>> the function (as a return variable, out parameter, or assigning it to
> >>> the property of some other non-local object), the rule shouldn't warn in
> >>> this case, or at least give a lower confidence, right?
> >>
> >> Yes, that sounds rights.
> >>
> >>>
> >>> Example:
> >>> class StreamFactory {
> >>> void GiveXStream (string file)
> >>
> >> ^ won't compile, I assume this should be returning a Stream and not
> >> void ;-)
> >
> > Actually once I changed this to return a Stream the rule will return
> > DoesNotApply (i.e. no defect). Your original test case was likely
> > different.
> 
> You sure it should be DoesNotApply instead of Success?

There's no difference between them, at least from a user perspective,
since no defect will be reported in both cases. As such this cannot be
the cause of reporting false positives.

>  I see 
> DoesNotApply would apply to methods that don't deal with IDisposable 
> objects at all.

That varies a bit between rules. The goal is to distinguish if the main
(heavy) rule logic was used (Success) or if we could short-circuit it
with basic checks (DoesNotApply).

The difference is useful when developing and testing. E.g. a
DoesNotApply that becomes a Success means to an optimization is not used
anymore (and we need to check if that was intended, or not, since it
will affect gendarme's performance).

Some day I hope to add a bit of instrumentation/benchmarking inside a
(existing or new) runner. The number of DoesNotApply versus Success
+Failure will give a big clue if a rule is a candidate for further
optimizations.

> I attached my unit tests in:
> 
> http://bugzilla.novell.com/666403

Thanks, I'll look at them tonight (or as soon as possible).

Sebastien

-- 
You received this message because you are subscribed to the Google Groups 
"Gendarme" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/gendarme?hl=en.

Reply via email to