From 9e85b86929bd2808cf791806b96896f886110906 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 16 Oct 2023 17:59:16 -0700 Subject: [PATCH] bump version to 20230912.04 --- CHANGES.md | 2 +- MANIFEST | 1 + bin/perltidy | 2 +- docs/ChangeLog.html | 37 +++++++++++++++++++++ docs/Tidy.html | 2 +- docs/perltidy.html | 38 ++++++++++++++++++++-- lib/Perl/Tidy.pm | 2 +- lib/Perl/Tidy.pod | 2 +- lib/Perl/Tidy/Debugger.pm | 2 +- lib/Perl/Tidy/Diagnostics.pm | 2 +- lib/Perl/Tidy/FileWriter.pm | 2 +- lib/Perl/Tidy/Formatter.pm | 10 +++--- 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/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 +- 21 files changed, 94 insertions(+), 26 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cb2b1d77..5ae7af23 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Perltidy Change Log -## 2023 09 12.03 +## 2023 09 12.04 - The --dump-block-summary (-dbs) option now includes the number of sub args in the 'type' column. For example, 'sub(9)' indicates a sub diff --git a/MANIFEST b/MANIFEST index 2301ab47..d30543be 100644 --- a/MANIFEST +++ b/MANIFEST @@ -77,6 +77,7 @@ t/snippets25.t t/snippets26.t t/snippets27.t t/snippets28.t +t/snippets29.t t/snippets3.t t/snippets4.t t/snippets5.t diff --git a/bin/perltidy b/bin/perltidy index 53ef0b9e..0a3741ea 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -5917,7 +5917,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20230912.03 +This man page documents perltidy version 20230912.04 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index 05b1f064..6a9c567c 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,5 +1,42 @@

Perltidy Change Log

+

2023 09 12.04

+ +
- The --dump-block-summary (-dbs) option now includes the number of sub
+  args in the 'type' column. For example, 'sub(9)' indicates a sub
+  with 9 args.  Subs whose arg count cannot easily be determined are
+  indicated as 'sub(*)'. The count does not include a leading '$self'
+  or '$class' arg.
+
+- Added flag --space-signature-paren=n, or -ssp=n (issue git #125).
+  This flag works the same as the existing flag --space-prototype-paren=n
+  except that it applies to the space before the opening paren of a sub
+  signature instead of a sub prototype.  Previously, there was no control
+  over this (a space always occurred). For example, given the following
+  line:
+
+    sub circle( $xc, $yc, $rad );
+
+  The following results can now be obtained, according to the value of n:
+
+    sub circle( $xc, $yc, $rad );   # n=0 [no space]
+    sub circle( $xc, $yc, $rad );   # n=1 [default; same as input]
+    sub circle ( $xc, $yc, $rad );  # n=2 [space]
+
+  The spacing in previous versions of perltidy corresponded to n=2 (always
+  a space). The new default value, n=1, will produce a space if and only
+  if there was a space in the input text.
+
+- The dump-block-summary option can report an if-elsif-elsif-.. chain
+  as a single line item with the notation -dbt='elsif3', for example,
+  where the '3' is an integer which specifies the minimum number of elsif
+  blocks required for a chain to be reported. The manual has details.
+
+- Fix problem c269, in which the new -ame parameter could incorrectly
+  emit an else block when two elsif blocks were separated by a hanging
+  side comment (a very rare situation).
+
+

2023 09 12

- Fix for git #124: remove a syntax error check which could cause
diff --git a/docs/Tidy.html b/docs/Tidy.html
index 4a755b8b..26474489 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20230912

+

This man page documents Perl::Tidy version 20230912.04

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index 18cc3049..dee6ace9 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -1241,6 +1241,28 @@ sub usage(); # n=1 [default; follows input] sub usage (); # n=2 [space]
+ +
-ssp=n or --space-signature-paren=n
+
+ +

This flag is analogous to the previous except that it applies to the space before the opening paren of a sub signature rather than a sub prototype.

+ +

For example, consider the following line:

+ +
      sub circle( $xc, $yc, $rad )
+ +

This space before the opening paren can be controlled with integer n which may have the value 0, 1, or 2 with these meanings:

+ +
    -ssp=0 means no space before the paren
+    -ssp=1 means follow the example of the source code [DEFAULT]
+    -ssp=2 means always put a space before the paren
+ +

The default is -ssp=1, meaning that will be a space in the output if, and only if, there is one in the input. Given the above line of code, the result of applying the different options would be:

+ +
    sub circle( $xc, $yc, $rad )   # n=0 [no space]
+    sub circle( $xc, $yc, $rad )   # n=1 [default; same as input]
+    sub circle ( $xc, $yc, $rad )  # n=2 [space]
+
-kpit=n or --keyword-paren-inner-tightness=n
@@ -4230,9 +4252,11 @@

This feature was developed to help identify complex sections of code as an aid in refactoring. The McCabe complexity measure follows the definition used by Perl::Critic. By default the table contains these values for subroutines, but the user may request them for any or all blocks of code or packages. For blocks which are loops nested within loops, a postfix '+' to the type is added to indicate possible code complexity. Although the table does not otherwise indicate which blocks are nested in other blocks, this can be determined by computing and comparing the block ending line numbers.

+

For subroutines, the number of call arguments (args) is listed in parentheses in the type column. For example, sub(9) indicates a sub with 9 args. Subroutines whose arg count cannot easily be determined are indicated as sub(*). The count does not include a leading variable named $self or $class.

+

By default the table lists subroutines with more than 20 code_lines, but this can be changed with the following two parameters:

-

--dump-block-minimum-lines=n, or -dbl=n, where n is the minimum number of code_lines to be included. The default is -n=20. Note that code_lines is the number of lines excluding and comments, blanks and pod.

+

--dump-block-minimum-lines=n, or -dbl=n, where n is the minimum number of code_lines to be included. The default is -n=20. Note that code_lines is the number of lines excluding comments, blanks and pod.

--dump-block-types=s, or -dbt=s, where string s is a list of block types to be included. The type of a block is either the name of the perl builtin keyword for that block (such as sub if elsif else for foreach ..) or the word immediately before the opening brace. In addition, there are a few symbols for special block types, as follows:

@@ -4242,7 +4266,10 @@ * - any block except nameless blocks + - any nested inner block loop package - any package or class - closure - any nameless block + closure - any nameless block + elsif3 - an if-elsif-..-else chain with 3 or more elsif's (3 is arbitrary, see below) + +

A chain of if-elsif-... blocks may be reported as a single line item by entering the word elsif with an appended integer, as indicated by the last item in this list. The integer indicates the number of elsif blocks required for a chain to be reported. If you use this, you may want to also use -dbl=n, with a smaller number of lines n than the default.

In addition, specific block loop types which are nested in other loops can be selected by adding a + after the block name. (Nested loops are sometimes good candidates for restructuring).

@@ -4271,6 +4298,11 @@
    perltidy -dbs -dbl=1 -dbt='* closure' somefile.pl >blocks.csv
+ +
  • This selects every if-chain which contains 2 or more elsif blocks:

    + +
        perltidy -dbs -dbl=1 -dbt='elsif2' somefile.pl >blocks.csv
    +
  • @@ -4597,7 +4629,7 @@

    VERSION

    -

    This man page documents perltidy version 20230912

    +

    This man page documents perltidy version 20230912.04

    BUG REPORTS

    diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 02b9b607..59c7386d 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -132,7 +132,7 @@ BEGIN { # then the Release version must be bumped, and it is probably past time for # a release anyway. - $VERSION = '20230912.03'; + $VERSION = '20230912.04'; } ## end BEGIN sub DESTROY { diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 3bdcae60..36174693 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -469,7 +469,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t =head1 VERSION -This man page documents Perl::Tidy version 20230912.03 +This man page documents Perl::Tidy version 20230912.04 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index e9b193b3..7b17eabb 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index 6bf4e1ff..c8d5f791 100644 --- a/lib/Perl/Tidy/Diagnostics.pm +++ b/lib/Perl/Tidy/Diagnostics.pm @@ -18,7 +18,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index 29e5f27c..52a5a60c 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -16,7 +16,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 299686aa..0025cd88 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -75,7 +75,7 @@ use constant SPACE => q{ }; use Carp; use English qw( -no_match_vars ); use List::Util qw( min max first ); # min, max first are in Perl 5.8 -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() @@ -6843,14 +6843,12 @@ sub count_sub_args { my $type_p = $rLL->[$K_p]->[_TYPE_]; my $token_p = $rLL->[$K_p]->[_TOKEN_]; - if ( $type_p eq 'k' - && $token_p =~ /^(my|our|local)$/ ) - { + if ( $type_p eq 'k' && $is_my_our_local{$token_p} ) { next; } - if ( $type_p eq 'i' - && $token_p =~ /^\$(self|class)$/ ) + if ( $type_p eq 'i' + && ( $token_p eq '$self' || $token_p eq '$class' ) ) { $arg_count_by_seqno{$seqno_current} = -1; $saw_self = 1; diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index a8ba8e27..b61da89d 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 = '20230912.03'; +our $VERSION = '20230912.04'; use English qw( -no_match_vars ); use File::Basename; diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index 7d6b4994..e13f421f 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 = '20230912.03'; +our $VERSION = '20230912.04'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/IOScalarArray.pm b/lib/Perl/Tidy/IOScalarArray.pm index 577ec6f9..13683632 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 = '20230912.03'; +our $VERSION = '20230912.04'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index e40cb147..d16dee06 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 = '20230912.03'; +our $VERSION = '20230912.04'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index a5031451..cea4eacc 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; use English qw( -no_match_vars ); use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 3e311702..35ad51ef 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -33,7 +33,7 @@ use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 246a472f..b6012970 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -3,7 +3,7 @@ use strict; use warnings; use Carp; use English qw( -no_match_vars ); -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; 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 20de373f..9427877a 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 = '20230912.03'; +our $VERSION = '20230912.04'; sub new { my ( $class, $rarg ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index eab9d986..107c52ad 100644 --- a/lib/Perl/Tidy/VerticalAligner/Line.pm +++ b/lib/Perl/Tidy/VerticalAligner/Line.pm @@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230912.03'; +our $VERSION = '20230912.04'; sub AUTOLOAD { -- 2.39.5