]> git.donarmstrong.com Git - perltidy.git/commitdiff
add some anonymous sub returns missed by perl critic
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 17 Sep 2021 22:14:46 +0000 (15:14 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 17 Sep 2021 22:14:46 +0000 (15:14 -0700)
CHANGES.md
lib/Perl/Tidy.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/HtmlWriter.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm

index 7c961d06fa6b6896d0914f797ec7a776f6f2d9c3..c33ffbff42f85df044f7f0eb971b41c88d5138f6 100644 (file)
@@ -2,6 +2,11 @@
 
 ## 2021 07 17.02
 
+    - Update the man pages to clarify the flags -valign and -novalign
+      for turning vertical alignment on and off (issue git #72).
+      Added parameters -vc -vsc -vbc for separately turning off vertical
+      alignment of code, side comments and block comments.
+
     - Fixed problem where a blank line following a closing code-skipping
       comment, '#>>V', can be lost.  A workaround for the previous version
       is to include the parameter '-mbl=2'.
index ffbfc4c483c158f8b65c632cac2cc933631199e1..0866f6a593da4fcad18501d3f93f8e1db597f14e 100644 (file)
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 #
 ###########################################################
 #
@@ -2219,6 +2218,7 @@ sub generate_options {
                 $expansion{$nshort_name} = [$nolong_name];
             }
         }
+        return;
     };
 
     # Install long option names which have a simple abbreviation.
@@ -3280,6 +3280,7 @@ sub check_options {
                 $rOpts->{$key} = 100;
             }
         }
+        return;
     };
 
     # check for reasonable number of blank lines and fix to avoid problems
index 133cc507a835567e45ff76f71a6fa9d2b83d6f6d..2bf07c48ebdbd1467bf40ab35ed1b8528ebf01a9 100644 (file)
@@ -1382,6 +1382,7 @@ EOM
                   ( $lbs, $rbs );
             }
         }
+        return;
     };
 
     my $break_before = sub {
@@ -1394,6 +1395,7 @@ EOM
                   ( $lbs, $rbs );
             }
         }
+        return;
     };
 
     $break_after->(@all_operators) if ( $rOpts->{'break-after-all-operators'} );
@@ -2312,6 +2314,7 @@ sub set_whitespace_flags {
                 $closing_container_inside_ws{$sequence_number} = $ws_flag;
             }
         }
+        return;
     };
 
     my ( $ws_1, $ws_2, $ws_3, $ws_4 );
@@ -5855,6 +5858,7 @@ sub respace_tokens {
 
         # and finally, add this item to the new array
         push @{$rLL_new}, $item;
+        return;
     };
 
     my $store_token_and_space = sub {
@@ -5891,6 +5895,7 @@ sub respace_tokens {
 
         # then the token
         $store_token->($item);
+        return;
     };
 
     my $add_phantom_semicolon = sub {
@@ -6019,6 +6024,7 @@ sub respace_tokens {
             $store_token->($rcopy);
             push @{$rK_phantom_semicolons}, @{$rLL_new} - 1;
         }
+        return;
     };
 
     my $check_Q = sub {
@@ -6087,6 +6093,7 @@ sub respace_tokens {
 "Line $lno: Note: be sure you want '$previous_nonblank_token' instead of '$guess' here\n"
             );
         }
+        return;
     };
 
     ############################################
@@ -10428,6 +10435,7 @@ EOM
                 }
             }
         }
+        return;
     };
 
     my $delete_if_blank = sub {
@@ -10456,6 +10464,7 @@ EOM
 
         while ( my $ibl = pop(@iblanks) ) { $rhash_of_desires->{$ibl} = 2 }
 
+        return;
     };
 
     my $end_group = sub {
@@ -10536,6 +10545,8 @@ EOM
         @group     = ();
         @subgroup  = ();
         @iblanks   = ();
+
+        return;
     };
 
     my $find_container_end = sub {
@@ -20182,10 +20193,10 @@ EOM
                     && $token =~ /$closing_side_comment_prefix_pattern/ )
             );
 
-            # - For the particular combination -vc -nvsc, we put all side comments
+            # - For the specific combination -vc -nvsc, we put all side comments
             #   at fixed locations. Note that we will lose hanging side comment
             #   alignments. Otherwise, hsc's can move to strange locations.
-            # - For -nvc -nvsc we will make all side comments vertical alignments
+            # - For -nvc -nvsc we make all side comments vertical alignments
             #   because the vertical aligner will check for -nvsc and be able
             #   to reduce the final padding to the side comments for long lines.
             #   and keep hanging side comments aligned.
@@ -21382,12 +21393,12 @@ sub pad_token {
     sub make_alignment_patterns {
 
         # Here we do some important preliminary work for the
-        # vertical aligner.  We create three arrays for one
+        # vertical aligner.  We create four arrays for one
         # output line. These arrays contain strings that can
         # be tested by the vertical aligner to see if
         # consecutive lines can be aligned vertically.
         #
-        # The three arrays are indexed on the vertical
+        # The four arrays are indexed on the vertical
         # alignment fields and are:
         # @tokens - a list of any vertical alignment tokens for this line.
         #   These are tokens, such as '=' '&&' '#' etc which
@@ -21400,6 +21411,8 @@ sub pad_token {
         # @patterns - a modified list of token types, one for each alignment
         #   field.  These should normally each match before alignment is
         #   allowed, even when the alignment tokens match.
+        # @field_lengths - the display width of each field
+
         my ( $self, $ibeg, $iend, $ralignment_type_to_go ) = @_;
         my @tokens        = ();
         my @fields        = ();
index 9ff2f57aeef8ee442326f97f832e90e888704d57..d957b15404cba153887da12e0da389c2c0f69326 100644 (file)
@@ -226,6 +226,7 @@ sub add_toc_item {
             $html_toc_fh->print("</ul>\n</li>\n");
             ${$rin_toc_package} = "";
         }
+        return;
     };
 
     my $start_package_list = sub {
@@ -236,6 +237,7 @@ sub add_toc_item {
 <ul>
 EOM
         ${$rin_toc_package} = $package;
+        return;
     };
 
     # start the table of contents on the first item
@@ -763,6 +765,7 @@ sub pod_to_html {
             $html_fh->print($_) unless ($no_print);
             if ($in_toc) { push @toc, $_ }
         }
+        return;
     };
 
     # loop over lines of html output from pod2html and merge in
@@ -1505,4 +1508,3 @@ EOM
     return;
 }
 1;
-
index 8ad5f09ac4adeeb00914824de921657a07d32aea..eefa467bfd3e4cdbeecb407f064beaa0a74fa6e4 100644 (file)
@@ -719,6 +719,7 @@ sub get_line {
     my $write_logfile_entry = sub {
         my ($msg) = @_;
         write_logfile_entry("Line $input_line_number: $msg");
+        return;
     };
 
     # Find and remove what characters terminate this line, including any
index 24ba98ab5398db0ae185367aca8c0a7064a9c830..32bd8656d9f6418f22ff0b848c5e2d7057854870 100644 (file)
@@ -342,11 +342,12 @@ sub valign_input {
 
     # Place one line in the current vertical group.
     #
-    # The input parameters are:
-    #     $level = indentation level of this line
-    #     $rfields = reference to array of fields
-    #     $rpatterns = reference to array of patterns, one per field
-    #     $rtokens   = reference to array of tokens starting fields 1,2,..
+    # The key input parameters describing each line are:
+    #     $level          = indentation level of this line
+    #     $rfields        = ref to array of fields
+    #     $rpatterns      = ref to array of patterns, one per field
+    #     $rtokens        = ref to array of tokens starting fields 1,2,..
+    #     $rfield_lengths = ref to array of field display widths
     #
     # Here is an example of what this package does.  In this example,
     # we are trying to line up both the '=>' and the '#'.
@@ -2044,6 +2045,7 @@ sub sweep_left_to_right {
                     # spot to take special action on failure to move
                 }
             }
+            return;
         };
 
         foreach my $task ( @{$rtodo} ) {
@@ -2924,6 +2926,7 @@ sub delete_null_alignments {
             my $length_match = $rfield_lengths_match->[$i];
             if ( $length ne $length_match ) { $rneed_pad->[$i] = 1 }
         }
+        return;
     };
 
     my $end_match = sub {
@@ -2972,6 +2975,7 @@ sub delete_null_alignments {
                 delete_selected_tokens( $rnew_lines->[$j], \@idel );
             }
         }
+        return;
     };
 
     foreach my $item ( @{$rsubgroups} ) {