From: Steve Hancock Date: Sun, 28 Feb 2021 14:41:16 +0000 (-0800) Subject: Do not start a batch with a blank token X-Git-Tag: 20210402~28 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8aaf599f306daec35204998166e07b241690d8f4;p=perltidy.git Do not start a batch with a blank token --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index c51825af..22b3eb7e 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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; diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 73c479b8..1a3c3fd8 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,43 @@ =over 4 +=item B + +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 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 @@ -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 diff --git a/local-docs/Release-Checklist.md b/local-docs/Release-Checklist.md index 5c236b28..96e5eb0f 100644 --- a/local-docs/Release-Checklist.md +++ b/local-docs/Release-Checklist.md @@ -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