]> git.donarmstrong.com Git - perltidy.git/commitdiff
Do not start a batch with a blank token
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 28 Feb 2021 14:41:16 +0000 (06:41 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 28 Feb 2021 14:41:16 +0000 (06:41 -0800)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod
local-docs/Release-Checklist.md

index c51825afcc038ea6ce7b592d18b26a17ee91b48c..22b3eb7e734ec1c934ae81bc16857a27a77234af 100644 (file)
@@ -9238,6 +9238,12 @@ EOM
             }
         }
 
+        # Do not start a batch with a blank token.
+        # Fixes cases b149 b888 b984 b985 b986 b987
+        else {
+            if ( $type eq 'b' ) { return }
+        }
+
         ++$max_index_to_go;
         $batch_CODE_type               = $CODE_type;
         $K_to_go[$max_index_to_go]     = $Ktoken_vars;
index 73c479b858b949419cbb43838641747d3c4ea4f0..1a3c3fd83796c40c0d827996c2700120de21a93b 100644 (file)
@@ -2,6 +2,43 @@
 
 =over 4
 
+=item B<Do not start a batch with a blank token>
+
+Perltidy does final formatting in discrete batches of tokens, where a batch is
+a continuous section of the total token list.  A batch begins a new line and
+will be broken into one or more lines.  If a batch starts with a blank token it
+will simply be skipped on on output. However, some rare problems have been
+found in random testing which can occur if a batch starts with a blank.  An 
+example is case b984 which has the following parameters:
+
+        # this is file 'b984.pro'
+        --block-brace-vertical-tightness=2
+        --indent-columns=10
+        --maximum-line-length=27
+        --outdent-keywords
+        --variable-maximum-line-length
+
+          # OLD: perltidy -pro=b984.pro
+          unless (
+                    exists $self->{
+                              'accession_number'} )
+          {         return "unknown";
+          }
+
+          # NEW: perltidy -pro=b984.pro
+          unless (
+                    exists $self->{
+                              'accession_number'} )
+          {       return "unknown";
+          }
+
+Both look OK, but the OLD version did not outdent the keyword 'return'
+as requested with the -okw flag.
+
+This update fixes cases b149 b888 b984 b985 b986 b987.
+
+28 Feb 2021.
+
 =item B<Avoid double spaces in -csc text output>
 
 Random testing produced some rare cases where two spaces could occur
@@ -37,7 +74,7 @@ Previously the last line had an extra space between the opening braces:
 
     } ## end while ( do {  { package DB...}})
 
-27 Feb 2021.
+27 Feb 2021, b22e891.
 
 
 =item B<Remove control of debug flag -fll>
@@ -46,7 +83,7 @@ Random testing produced an unstable state when a debug flag, -nfll, was set.
 The only time it is appropriate to set this flag is if the -extrude option is
 set, so a check was added to verify this.  This fixes case b935.
 
-27 Feb 2021.
+27 Feb 2021, 9155b3d.
 
 =item B<Restrict previous update to just -vmll>
 
index 5c236b28d916a79b069ab00a9f57321f1724a943..96e5eb0fceddda3534a98558933be0081e1782b0 100644 (file)
@@ -9,6 +9,7 @@
   perl -d:NYTProf perltidy.pl -pbp -nst -nse -wn -xci perltidy.pl
   nytprofhtml --open
 - run random testing on final version for a significant time before releasing (several days)
+- rerun all resolved blinker test cases to verify that all still run correctly
 - run 'author tests' on a much larger body of code than is covered by the .t
   files.
     - compare results of the current version with previous version