[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl::Critic Tests



On Sat, Apr 15, 2017 at 12:14:35PM +0100, Nick Prater wrote:

> To my mind we should aim to get as many policies in place as soon as 
> possible. Fixing the policies with fewest violations first allows us to 
> add policies to the tests sooner, meaning new code is better tested.

I have started on 'RequireFinalReturn' and am looking for guidance on
what we  want done in two situations.

So far, most of the pod doesn't say anything about the intended return
value(s).  So I look at the function and add a return which preserves
the behavior.  Very cautious and pretty quick.

I feel that I am annotating the code and misleading any reader.

Some look to be routines where the return value is not to be used;
so a bare final return is appropriate or a return undef. Either of
those  may be a change in logic and produce bugs. So I preserve
the behavior by returning what is being returned.

This looks very wierd to me.  I can just 
"## no critic (RequireFinalReturn)" 
these functions; be a bit less cautious about putting in a return; 
or go with weird.

The second situation is when the end of a function is not reachable.
My personal practice is to 'die "Unreachable";'.  
What do we desire in this case?

Thanks,
Rob
 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel