perlcritic: Missing "return"

From: Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com>
To: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: perlcritic: Missing "return"
Date: 2018-05-11 13:59:23
Message-ID: CANPAkgvZYQxc=RTx1JKOZtPy5BC4UQK=qZZmEZ-F2+ciAXNbZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

After applying the perlcritic overrides Andrew used for the buildfarm, one
of the most common remaining level 4 warnings in the PostgreSQL source,
with 186 occurrences, is 'Subroutine does not end with "return"'.

The point of this warning is that, in Perl, falling off the end of a
subroutine returns the result of the last statement. Therefor one should
explicitly 'return;' to make it clear the caller is not expecting that
result as the return value.

I believe Andrew took the approach of adding return at the end of all
functions for the buildfarm code. Would the project prefer the same? The
other option would be disable the warning, based on a policy of always
explicitly using 'return' when returning a value.

Thoughts?

Mike B
* <Mike(dot)Blackwell(at)rrd(dot)com>*

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2018-05-11 14:02:38 Re: [HACKERS] Surjective functional indexes
Previous Message Heikki Linnakangas 2018-05-11 13:28:04 Re: Considering signal handling in plpython again