Re: cleaning perl code

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: cleaning perl code
Дата
Msg-id 21773.1586626276@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: cleaning perl code  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Список pgsql-hackers
Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> On 4/11/20 12:48 PM, Tom Lane wrote:
>> Is there a way to modify the test so that it only complains when
>> the final return is missing and there are other return(s) with values?
>> That would seem like a more narrowly tailored check.

> Not AFAICS:
> <https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::RequireFinalReturn>

Yeah, the list of all policies in the parent page doesn't offer any
promising alternatives either :-(

BTW, this bit in the policy's man page seems pretty disheartening:

    Be careful when fixing problems identified by this Policy; don't
    blindly put a return; statement at the end of every subroutine.

since I'd venture that's *exactly* what we've done every time perlcritic
moaned about this.  I wonder what else the author expected would happen.

> That would probably require writing a replacement module. Looking at the
> source if this module I think it might be possible, although I don't
> know much of the internals of perlcritic.

I doubt we want to go maintaining our own perlcritic policies; aside from
the effort involved, it'd become that much harder for anyone to reproduce
the results.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: cleaning perl code
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Complete data erasure