]> granicus.if.org Git - postgresql/commitdiff
Clean up some perlcritic warnings
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 7 May 2018 19:21:00 +0000 (15:21 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 7 May 2018 19:35:32 +0000 (15:35 -0400)
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.

src/backend/catalog/Catalog.pm
src/backend/utils/Gen_dummy_probes.pl
src/pl/plperl/plc_perlboot.pl
src/pl/plperl/plc_trusted.pl

index 7497d9cd9fbcc874f074eb9229c31f2e5878966a..f387c865c6818a5b0bd980ab6f97e153998cb5df 100644 (file)
@@ -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";
index a38fea3e043e3d8e03e19daaff607dd1cc840a08..91d79684e997ab98708bd92596bdf9748dd7449c 100644 (file)
@@ -14,6 +14,9 @@
 #
 #-------------------------------------------------------------------------
 
+# turn off perlcritic for autogened code
+## no critic
+
 $0 =~ s/^.*?(\w+)[\.\w+]*$/$1/;
 
 use strict;
index ff059648696f8409e0e61ec8d255f43d8311ce8a..05334a662d3317fb2c3dbd9b91acead3c58ba00d 100644 (file)
@@ -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;
 
index 7b11a3f52b0756b51ac7dd6ab644c0a2a282a3bd..dea3727682cf577fb7b92f2bd9641ac851d282af 100644 (file)
@@ -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.
 #