From ceb4decb2b8a65b97ea4dda3bd5fcf474c65571f Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 9 Oct 2020 07:14:21 -0700 Subject: [PATCH] bump version number by .01 --- CHANGES.md | 4 ++ bin/perltidy | 24 +++---- docs/BugLog.html | 60 +++++++++++++++++ docs/ChangeLog.html | 12 ++++ docs/Tidy.html | 2 +- docs/perltidy.html | 75 +++++++++++++++++++--- lib/Perl/Tidy.pm | 2 +- lib/Perl/Tidy.pod | 2 +- lib/Perl/Tidy/Debugger.pm | 2 +- lib/Perl/Tidy/DevNull.pm | 2 +- lib/Perl/Tidy/Diagnostics.pm | 2 +- lib/Perl/Tidy/FileWriter.pm | 2 +- lib/Perl/Tidy/Formatter.pm | 2 +- lib/Perl/Tidy/HtmlWriter.pm | 2 +- lib/Perl/Tidy/IOScalar.pm | 2 +- lib/Perl/Tidy/IOScalarArray.pm | 2 +- lib/Perl/Tidy/IndentationItem.pm | 2 +- lib/Perl/Tidy/LineBuffer.pm | 2 +- lib/Perl/Tidy/LineSink.pm | 2 +- lib/Perl/Tidy/LineSource.pm | 2 +- lib/Perl/Tidy/Logger.pm | 2 +- lib/Perl/Tidy/Tokenizer.pm | 2 +- lib/Perl/Tidy/VerticalAligner.pm | 2 +- lib/Perl/Tidy/VerticalAligner/Alignment.pm | 2 +- lib/Perl/Tidy/VerticalAligner/Line.pm | 2 +- 25 files changed, 175 insertions(+), 40 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 41c98d94..60e04b7c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,11 @@ # Perltidy Change Log +## 2020 10 01.01 + - Add flag -xci, --extended-continuation-indentation, regarding issue git #28 + - Fix issue git #42, clarify how --break-at-old-logical-breakpoints works. + - Fix issue git #41, typo in manual regarding -fsb - Fix issue git #40: when using the -bli option, a closing brace followed by diff --git a/bin/perltidy b/bin/perltidy index 4d2bebff..13d56ffc 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -731,21 +731,23 @@ number of spaces assigned to a full indentation level on the B<-i=n> command, or =item B<-xci>, B<--extended-continuation-indentation> -This flag causes continuation indentation to "extend" deeper into containers. -It is a fairly recent addition and is set off by default to avoid disturbing -existing formatting. If you use a continuation indentation equal to the -indentation, you will probably want to set this flag. +This flag causes continuation indentation to "extend" deeper into structures. +If you use B<-ci=n> and B<-i=n> with the same value of B you will probably +want to set this flag. Since this is a fairly new flag, the default is B<-nxci> +to avoid disturbing existing formatting. Here is an explanation. There are two common strategies for continuation indentation. One is the strategy recommend in the original perl style guidelines, in which B<-ci=2> and B<-i=4>. The other is the strategy is the -strategy recommended in the Perl Best Practices (B<-pbp>) by Conway, in which -B<-ci=4> and B<-i=4>. The default formatting in perltidy works fairly well -with the orignal perl style, but problems arise when B<-ci> and B<-i> are given -equal values as in the B style, particularly with ternary statements. The -B<-xci> flag was added to fix this. +strategy recommended for example in the "Perl Best Practices" book by Conway, +in which B<-ci=4> and B<-i=4>. The default formatting in perltidy works fairly +well with the orignal perl style, but problems arise when B<-ci> and B<-i> are +given equal values as in the B style, particularly with ternary +statements. The B<-xci> flag was added to fix this. It may be used with +any value of B<-ci> but is particularly helpful when B<-ci> and B<-i> are given +similar values. -For an illustration, please see the section on the B<--perl-best-practices> flag. +For an illustration, please see the section L<"B<-pbp>, B<--perl-best-practices>">. =item B<-sil=n> B<--starting-indentation-level=n> @@ -4350,7 +4352,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20201001 +This man page documents perltidy version 20201001.01 =head1 BUG REPORTS diff --git a/docs/BugLog.html b/docs/BugLog.html index 476bbf36..36cb81fb 100644 --- a/docs/BugLog.html +++ b/docs/BugLog.html @@ -12,9 +12,49 @@ +

Issues fixed after release 20201001

+ +
+ +
terminal braces not indenting correctly with -bli formatting, issue git #40
+
+ +

This problem is illustrated with the following snippet when run with -bli -blil='*'

+ +
    #-bli -bli list='*'
+    try
+      {
+        die;
+      }
+    catch
+      {
+        die;
+      };    # <-- this was not indenting
+ +

This was due to conflicting rules and was fixed 1 Oct 2020 in commit 'fix issue git #40, incorrect closing brace indentation with -bli', a5aefe9.

+ +

At the same time, it was noted that block types sort/map/grep and eval were not following -bli formatting when -blil='*' and this was fixed. For example, with corrected formatting, we would have

+ +
  # perltidy -bli -blil='*'
+    eval
+      {
+        my $app = App::perlbrew->new( "install-patchperl", "-q" );
+        $app->run();
+      }
+      or do
+      {
+        $error          = $@;
+        $produced_error = 1;
+      };
+ +
+
+

Issues fixed after release 20200907

This is a detailed log of changes since the release 20200907. All bugs were found with the help of automated random testing.

@@ -385,6 +425,26 @@ +

POD ERRORS

+ +

Hey! The above document had some coding errors, which are explained below:

+ +
+ +
Around line 3:
+
+ +

'=item' outside of any '=over'

+ +
+
Around line 36:
+
+ +

You forgot a '=back' before '=head1'

+ +
+
+ diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index 1322e7af..35e1ab06 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,5 +1,17 @@

Perltidy Change Log

+

2020 10 01.01

+ +
- Add flag -xci, --extended-continuation-indentation, regarding issue git #28
+
+- Fix issue git #42, clarify how --break-at-old-logical-breakpoints works.
+
+- Fix issue git #41, typo in manual regarding -fsb
+
+- Fix issue git #40: when using the -bli option, a closing brace followed by 
+  a semicolon was not being indented.
+
+

2020 10 01

- Robustness of perltidy has been significantly improved.  Updating is recommended. Continual 
diff --git a/docs/Tidy.html b/docs/Tidy.html
index d484ed58..993d8d7f 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -372,7 +372,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20201001

+

This man page documents Perl::Tidy version 20201001.01

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index 95d6455c..f87b0795 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -556,7 +556,21 @@

The value given to -ci is also used by some commands when a small space is required. Examples are commands for outdenting labels, -ola, and control keywords, -okw.

-

When default values are not used, it is highly recommended that the value n given with -ci=n be no more than about one-half of the number of spaces assigned to a full indentation level on the -i=n command. The reason is that discontinuities in the definition and control of continuation indentation arise in complex code, and this rule helps to smooth out these discontinuities.

+

When default values are not used, it is recommended that either

+ +

(1) the value n given with -ci=n be no more than about one-half of the number of spaces assigned to a full indentation level on the -i=n command, or

+ +

(2) the flag -extended-continuation-indentation is used (see next section).

+ + +
-xci, --extended-continuation-indentation
+
+ +

This flag causes continuation indentation to "extend" deeper into structures. If you use -ci=n and -i=n with the same value of n you will probably want to set this flag. Since this is a fairly new flag, the default is -nxci to avoid disturbing existing formatting.

+ +

Here is an explanation. There are two common strategies for continuation indentation. One is the strategy recommend in the original perl style guidelines, in which -ci=2 and -i=4. The other is the strategy is the strategy recommended for example in the "Perl Best Practices" book by Conway, in which -ci=4 and -i=4. The default formatting in perltidy works fairly well with the orignal perl style, but problems arise when -ci and -i are given equal values as in the pbp style, particularly with ternary statements. The -xci flag was added to fix this. It may be used with any value of -ci but is particularly helpful when -ci and -i are given similar values.

+ +

For an illustration, please see the section "-pbp, --perl-best-practices".

-sil=n --starting-indentation-level=n
@@ -914,6 +928,21 @@
  # perltidy -nwrs='-'
   my @newkeys = map $_ -$nrecs + @data, @oldkeys;
+

For another example, the following two lines will be parsed without syntax error:

+ +
  # original programming, syntax ok
+  for my $severity ( reverse $SEVERITY_LOWEST+1 .. $SEVERITY_HIGHEST ) { ...  }
+
+  # perltidy default, syntax ok
+  for my $severity ( reverse $SEVERITY_LOWEST + 1 .. $SEVERITY_HIGHEST ) { ... }
+ +

But the following will give a syntax error:

+ +
  # perltidy -nwrs='+', syntax error:
+  for my $severity ( reverse $SEVERITY_LOWEST +1 .. $SEVERITY_HIGHEST ) { ... }
+ +

To avoid subtle parsing problems like this, it is best to avoid spacing a binary operator asymetrically with a space on the left but not on the right.

+
Space between specific keywords and opening paren
@@ -965,10 +994,10 @@

The reason this is not recommended is that spacing a function paren can make a program vulnerable to parsing problems by Perl. For example, the following two-line program will run as written but will have a syntax error if reformatted with -sfp:

-
  if ( -e filename() ) { print "exists\n"; }
+
  if ( -e filename() ) { print "I'm here\n"; }
   sub filename { return $0 }
-

The syntax error can be removed if the line order is reversed, so that Perl parses 'sub filename' first.

+

In this particular case the syntax error can be removed if the line order is reversed, so that Perl parses 'sub filename' first.

-spp=n or --space-prototype-paren=n
@@ -1462,7 +1491,7 @@
-fse=string, --format-skipping-end=string
-

The -fsb=string is the corresponding parameter used to change the ending marker for format skipping. The default is equivalent to -fse='#<<<'.

+

The -fse=string is the corresponding parameter used to change the ending marker for format skipping. The default is equivalent to -fse='#<<<'.

The beginning and ending strings may be the same, but it is preferable to make them different for clarity.

@@ -2306,6 +2335,23 @@

By default, if a logical expression is broken at a &&, ||, and, or or, then the container will remain broken. Also, breaks at internal keywords if and unless will normally be retained. To prevent this, and thus form longer lines, use -nbol.

+

Please note that this flag does not duplicate old logical breakpoints. They are merely used as a hint with this flag that a statement should remain broken. Without this flag, perltidy will normally try to combine relatively short expressions into a single line.

+ +

For example, given this snippet:

+ +
    return unless $cmd = $cmd || ($dot 
+        && $Last_Shell) || &prompt('|');
+
+    # perltidy -bol [default]
+    return
+      unless $cmd = $cmd
+      || ( $dot
+        && $Last_Shell )
+      || &prompt('|');
+
+    # perltidy -nbol
+    return unless $cmd = $cmd || ( $dot && $Last_Shell ) || &prompt('|');
+
-bom, --break-at-old-method-breakpoints
@@ -2713,7 +2759,7 @@

Please note that this parameter set includes -st and -se flags, which make perltidy act as a filter on one file only. These can be overridden by placing -nst and/or -nse after the -pbp parameter.

-

Also note that the value of continuation indentation, -ci=4, is equal to the value of the full indentation, -i=4. In some complex statements perltidy will produce nicer results with -ci=2. This can be implemented by including -ci=2 after the -pbp parameter. For example,

+

Also note that the value of continuation indentation, -ci=4, is equal to the value of the full indentation, -i=4. It is recommended that the either (1) the parameter -ci=2 be used instead, or the flag -xci be set. This will help show structure, particularly when there are ternary statements. The following snippet illustrates these options.

    # perltidy -pbp
     $self->{_text} = (
@@ -2737,7 +2783,20 @@
         $page
         ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage"
         : ' elsewhere in this document'
-      );
+ ); + + # perltidy -pbp -xci + $self->{_text} = ( + !$section ? '' + : $type eq 'item' ? "the $section entry" + : "the section on $section" + ) + . ( $page + ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage" + : ' elsewhere in this document' + );
+ +

The -xci flag was developed after the -pbp parameters were published so you need to include it separately.

One-line blocks
@@ -2745,8 +2804,6 @@

There are a few points to note regarding one-line blocks. A one-line block is something like this,

-
        if ($x > 0) { $y = 1 / $x }  
-

where the contents within the curly braces is short enough to fit on a single line.

With few exceptions, perltidy retains existing one-line blocks, if it is possible within the line-length constraint, but it does not attempt to form new ones. In other words, perltidy will try to follow the one-line block style of the input file.

@@ -3313,7 +3370,7 @@

VERSION

-

This man page documents perltidy version 20201001

+

This man page documents perltidy version 20201001.01

BUG REPORTS

diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index a77d25c2..acff7509 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -107,7 +107,7 @@ BEGIN { # Release version must be bumped, and it is probably past time for a # release anyway. - $VERSION = '20201001'; + $VERSION = '20201001.01'; } sub DESTROY { diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 922766b1..7365238b 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -432,7 +432,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t =head1 VERSION -This man page documents Perl::Tidy version 20201001 +This man page documents Perl::Tidy version 20201001.01 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 96ad3f3f..3362de59 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -7,7 +7,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub new { diff --git a/lib/Perl/Tidy/DevNull.pm b/lib/Perl/Tidy/DevNull.pm index 19dab097..a17fe974 100644 --- a/lib/Perl/Tidy/DevNull.pm +++ b/lib/Perl/Tidy/DevNull.pm @@ -7,7 +7,7 @@ package Perl::Tidy::DevNull; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub new { my $self = shift; return bless {}, $self } sub print { return } sub close { return } diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index 718daf65..901d33c2 100644 --- a/lib/Perl/Tidy/Diagnostics.pm +++ b/lib/Perl/Tidy/Diagnostics.pm @@ -20,7 +20,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index fa3e23f9..647ac4ec 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 21405861..d0e9fa8c 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -49,7 +49,7 @@ use constant DEVEL_MODE => 0; { #<<< A non-indenting brace to contain all lexical variables use Carp; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index f59f2718..2fe50ad8 100644 --- a/lib/Perl/Tidy/HtmlWriter.pm +++ b/lib/Perl/Tidy/HtmlWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::HtmlWriter; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; use File::Basename; diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index 70154271..874c57ab 100644 --- a/lib/Perl/Tidy/IOScalar.pm +++ b/lib/Perl/Tidy/IOScalar.pm @@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar; use strict; use warnings; use Carp; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/IOScalarArray.pm b/lib/Perl/Tidy/IOScalarArray.pm index 66d28d5a..df231917 100644 --- a/lib/Perl/Tidy/IOScalarArray.pm +++ b/lib/Perl/Tidy/IOScalarArray.pm @@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray; use strict; use warnings; use Carp; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index 4c2bd199..85e77c02 100644 --- a/lib/Perl/Tidy/IndentationItem.pm +++ b/lib/Perl/Tidy/IndentationItem.pm @@ -8,7 +8,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; BEGIN { diff --git a/lib/Perl/Tidy/LineBuffer.pm b/lib/Perl/Tidy/LineBuffer.pm index af2476a9..bb5ebdd0 100644 --- a/lib/Perl/Tidy/LineBuffer.pm +++ b/lib/Perl/Tidy/LineBuffer.pm @@ -12,7 +12,7 @@ package Perl::Tidy::LineBuffer; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/LineSink.pm b/lib/Perl/Tidy/LineSink.pm index 71794f81..6c701d87 100644 --- a/lib/Perl/Tidy/LineSink.pm +++ b/lib/Perl/Tidy/LineSink.pm @@ -8,7 +8,7 @@ package Perl::Tidy::LineSink; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/LineSource.pm b/lib/Perl/Tidy/LineSource.pm index faf71a0d..43b605ff 100644 --- a/lib/Perl/Tidy/LineSource.pm +++ b/lib/Perl/Tidy/LineSource.pm @@ -8,7 +8,7 @@ package Perl::Tidy::LineSource; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index ac9c3772..fbbbfc84 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -7,7 +7,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; sub AUTOLOAD { diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 27ceee9f..ab13c6ee 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -21,7 +21,7 @@ package Perl::Tidy::Tokenizer; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; use Perl::Tidy::LineBuffer; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 55c3fa96..56dbeb8a 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -1,7 +1,7 @@ package Perl::Tidy::VerticalAligner; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; use Perl::Tidy::VerticalAligner::Alignment; use Perl::Tidy::VerticalAligner::Line; diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 8e34b143..3d79829f 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -10,7 +10,7 @@ use warnings; { #<<< A non-indenting brace -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; # _column_ # the current column number # _starting_column_ # column number when created diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index f0cfae93..f35ecf3b 100644 --- a/lib/Perl/Tidy/VerticalAligner/Line.pm +++ b/lib/Perl/Tidy/VerticalAligner/Line.pm @@ -8,7 +8,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; -our $VERSION = '20201001'; +our $VERSION = '20201001.01'; BEGIN { my $i = 0; -- 2.39.5