From: Andrew Dunstan Date: Mon, 7 May 2018 19:21:00 +0000 (-0400) Subject: Clean up some perlcritic warnings X-Git-Tag: REL_11_BETA1~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2c1512ac48c1c25dfec07d341e9b74e57f6fbc4;p=postgresql Clean up some perlcritic warnings In Catalog.pm, mark eval of a string instead of a block as allowed. Disallow perlcritic completely in Gen_dummy_probes.pl, as it's generated code. Protect a couple of lines in plperl code from perltidy, so that the annotation for perlcritic stays on the same line as the construct it would otherwise object to. --- diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index 7497d9cd9f..f387c865c6 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -250,7 +250,10 @@ sub ParseData if ($lcnt == $rcnt) { - eval '$hash_ref = ' . $_; + # We're treating the input line as a piece of Perl, so we + # need to use string eval here. Tell perlcritic we know what + # we're doing. + eval '$hash_ref = ' . $_; ## no critic (ProhibitStringyEval) if (!ref $hash_ref) { die "$input_file: error parsing line $.:\n$_\n"; diff --git a/src/backend/utils/Gen_dummy_probes.pl b/src/backend/utils/Gen_dummy_probes.pl index a38fea3e04..91d79684e9 100644 --- a/src/backend/utils/Gen_dummy_probes.pl +++ b/src/backend/utils/Gen_dummy_probes.pl @@ -14,6 +14,9 @@ # #------------------------------------------------------------------------- +# turn off perlcritic for autogened code +## no critic + $0 =~ s/^.*?(\w+)[\.\w+]*$/$1/; use strict; diff --git a/src/pl/plperl/plc_perlboot.pl b/src/pl/plperl/plc_perlboot.pl index ff05964869..05334a662d 100644 --- a/src/pl/plperl/plc_perlboot.pl +++ b/src/pl/plperl/plc_perlboot.pl @@ -51,9 +51,9 @@ sub ::encode_array_constructor } { - - package PostgreSQL::InServer - ; ## no critic (RequireFilenameMatchesPackage); +#<<< protect next line from perltidy so perlcritic annotation works + package PostgreSQL::InServer; ## no critic (RequireFilenameMatchesPackage) +#>>> use strict; use warnings; diff --git a/src/pl/plperl/plc_trusted.pl b/src/pl/plperl/plc_trusted.pl index 7b11a3f52b..dea3727682 100644 --- a/src/pl/plperl/plc_trusted.pl +++ b/src/pl/plperl/plc_trusted.pl @@ -1,7 +1,8 @@ # src/pl/plperl/plc_trusted.pl -package PostgreSQL::InServer::safe - ; ## no critic (RequireFilenameMatchesPackage); +#<<< protect next line from perltidy so perlcritic annotation works +package PostgreSQL::InServer::safe; ## no critic (RequireFilenameMatchesPackage) +#>>> # Load widely useful pragmas into plperl to make them available. #