]> git.donarmstrong.com Git - perltidy.git/commitdiff
add PC policy Subroutines::RequireArgUnpacking
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 17 Jul 2022 13:40:26 +0000 (06:40 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 17 Jul 2022 13:40:26 +0000 (06:40 -0700)
.perlcriticrc
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/VerticalAligner.pm
lib/Perl/Tidy/VerticalAligner/Line.pm

index 2ef70d961df613c108e7badd5be8d6f4038c3439..b52435f911c5f3882f096a532b223a86fb0f43ea 100644 (file)
@@ -43,9 +43,8 @@ verbose = %f: [%p] %m at line %l, column %c.\n
 # Nested subs are used for error handling in Tidy.pm.
 [-Subroutines::ProhibitNestedSubs]
 
-# In critical routines this can significantly reduce processing speed.
-# So we have to skip it.
-[-Subroutines::RequireArgUnpacking]
+[Subroutines::RequireArgUnpacking]
+short_subroutine_statements = 2
 
 # Completely Disagree. The advantages of 'use constant' greatly outweigh the
 # few disadvantages.  Perl::Tidy relies heavily on constants for efficient and
index 2840539c23de08edf039b0e5b25dbf308551d8e5..0920de7e536af5491f3eece68d0a90de38e40e22 100644 (file)
@@ -24515,8 +24515,8 @@ sub pad_token {
         @{is_binary_type}{@q} = (1) x scalar(@q);
 
         # token keywords which prevent using leading word as a container name
-        @_ = qw(and or err eq ne cmp);
-        @is_binary_keyword{@_} = (1) x scalar(@_);
+        @q = qw(and or err eq ne cmp);
+        @is_binary_keyword{@q} = (1) x scalar(@q);
 
         # Some common function calls whose args can be aligned.  These do not
         # give good alignments if the lengths differ significantly.
index c9dc2cd965fc090ac53b7c21bfc49e6a4c188c98..d6b0c4feceb1c6fbf3a9816078433acd8ec9b9e2 100644 (file)
@@ -4944,9 +4944,9 @@ sub combine_fields {
     my $jmax_new = $line_0->{'jmax'};
 
     $new_alignments[ $jmax_new - 1 ] = $old_alignments[ $jmax_old - 1 ];
-    $new_alignments[$jmax_new] = $old_alignments[$jmax_old];
-    $line_0->{'ralignments'} = \@new_alignments;
-    $line_1->{'ralignments'} = \@new_alignments;
+    $new_alignments[$jmax_new]       = $old_alignments[$jmax_old];
+    $line_0->{'ralignments'}         = \@new_alignments;
+    $line_1->{'ralignments'}         = \@new_alignments;
     return;
 }
 
index a03191ec22c359dcfbaa3bf94ca87848dda22392..604a4ec681f15fcf5ef524fc0ab67e4bbd595b47 100644 (file)
@@ -42,10 +42,9 @@ EOM
         return $self;
     }
 
-    # This sub is called many times and has been optimized a bit
     sub get_column {
-        ##my ( $self, $j ) = @_;
-        my $alignment = $_[0]->{ralignments}->[ $_[1] ];
+        my ( $self, $j ) = @_;
+        my $alignment = $self->{ralignments}->[$j];
         return unless defined($alignment);
         return $alignment->get_column();
     }