On Mon, Jul 11, 2005 at 07:38:57PM +0300, Yuval Kogman wrote:
> > So what should I do to eliminate it?
> 
> Maybe Just Nothing
> 
> The issue is that you can't special case get_current_coords to be
> truish, as far as Devel::Cover is concerned - it might not be.
> 
> Any fix that could be thought up is inherently problematic.
> 
> Coverage reporting is not done for the pretty colors - a human reads
> it, and says "OK, this is logical, get_current_coords always returns
> a true value". It's not a race for greens and percentages.

While I agree coverage is not a race, I disagree that a human should have
to disambiguate between real missing coverage and a false negative.  At
least not more than once.

I'll make the same argument "no broken windows" argument here that I do 
about warnings and tests:  elminate all warnings, even if they are dubious.  
Ensure all tests pass eliminating all false negatives.  Do not leave any 
"expected warnings" or "expected failures" because this erodes the 
confidence in the test suite.  Warnings and test failures fail to ring alarm
bells.  One "expected" warning leads to two.  Then four.  Then finally too
many to remember which are expected and which are not and you ignore them
all together.

The Pragmatic Programmer does a good job with this argument.
http://www.pragmaticprogrammer.com/ppbook/extracts/no_broken_windows.html

So goes the same with coverage.  Red should be a BAD color, something you
do not want to see.  You want to eliminate the red.  But sometimes its a
false negative.  In that case there should be some way to tell the tool
that it is, in fact, a false negative.  Just like skipping tests, you
store the fact that there is a false negative to make the red go away.  Red
remains a bad color and seeing it means something is wrong.  The team doesn't
have to remember which bits are expected to be uncovered and which are not.

What's missing is a way to let Devel::Cover know that a bit of coverage is
not necessary.  The first way to do this which pops into my mind is a comment.

        my $foo = $bar || default();  # DC ignore X|0

"Hey, Devel::Cover!  Ignore the case where the right side of this logic is
false."

Ignored conditions would be green, but perhaps a slightly different shade of
green so they can be spotted if you're looking for them.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
'All anyone gets in a mirror is themselves,' she said. 'But what you
gets in a good gumbo is everything.'
        -- "Witches Abroad" by Terry Prachett

Reply via email to