]> git.donarmstrong.com Git - perltidy.git/commitdiff
bump version to 20230912.04 20230912.04
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 17 Oct 2023 00:59:16 +0000 (17:59 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 17 Oct 2023 00:59:16 +0000 (17:59 -0700)
21 files changed:
CHANGES.md
MANIFEST
bin/perltidy
docs/ChangeLog.html
docs/Tidy.html
docs/perltidy.html
lib/Perl/Tidy.pm
lib/Perl/Tidy.pod
lib/Perl/Tidy/Debugger.pm
lib/Perl/Tidy/Diagnostics.pm
lib/Perl/Tidy/FileWriter.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/HtmlWriter.pm
lib/Perl/Tidy/IOScalar.pm
lib/Perl/Tidy/IOScalarArray.pm
lib/Perl/Tidy/IndentationItem.pm
lib/Perl/Tidy/Logger.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm
lib/Perl/Tidy/VerticalAligner/Alignment.pm
lib/Perl/Tidy/VerticalAligner/Line.pm

index cb2b1d7757b7da031cad43ce0f0b8bc711f3432b..5ae7af23c841139918e24ca76300f9e663eb9af0 100644 (file)
@@ -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
index 2301ab472115b862688d61fa77c5599a69993d0c..d30543beaa6d4b625fd054e0d20a98ed05b0a619 100644 (file)
--- 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
index 53ef0b9ec26cf5fdf6ba90f2e2f11f177e9aec12..0a3741ea32ce7d1abfab98d0b279411423c29258 100755 (executable)
@@ -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
 
index 05b1f064c9a36755c2213c33f609df6fcd983c91..6a9c567cb77efe73a032ba07d22009a9c12e23c8 100644 (file)
@@ -1,5 +1,42 @@
 <h1>Perltidy Change Log</h1>
 
+<h2>2023 09 12.04</h2>
+
+<pre><code>- 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).
+</code></pre>
+
 <h2>2023 09 12</h2>
 
 <pre><code>- Fix for git #124: remove a syntax error check which could cause
index 4a755b8be2690aa8d833e4695d66ee2dbc74657d..26474489a81af457b3c72945dcf7c79aa236ef30 100644 (file)
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents Perl::Tidy version 20230912</p>
+<p>This man page documents Perl::Tidy version 20230912.04</p>
 
 <h1 id="LICENSE">LICENSE</h1>
 
index 18cc304919fead9c91d2c4675915e15d6a95c01e..dee6ace95a5132dce66fc347cdd3693b3278efcc 100644 (file)
         sub usage();    # n=1 [default; follows input]
         sub usage ();   # n=2 [space]</code></pre>
 
+</dd>
+<dt id="ssp-n-or---space-signature-paren-n"><b>-ssp=n</b> or <b>--space-signature-paren=n</b></dt>
+<dd>
+
+<p>This flag is analogous to the previous except that it applies to the space before the opening paren of a sub <b>signature</b> rather than a sub <b>prototype</b>.</p>
+
+<p>For example, consider the following line:</p>
+
+<pre><code>      sub circle( $xc, $yc, $rad )</code></pre>
+
+<p>This space before the opening paren can be controlled with integer <b>n</b> which may have the value 0, 1, or 2 with these meanings:</p>
+
+<pre><code>    -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</code></pre>
+
+<p>The default is <b>-ssp=1</b>, 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:</p>
+
+<pre><code>    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]</code></pre>
+
 </dd>
 <dt id="kpit-n-or---keyword-paren-inner-tightness-n"><b>-kpit=n</b> or <b>--keyword-paren-inner-tightness=n</b></dt>
 <dd>
 
 <p>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 &#39;+&#39; to the <code>type</code> 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.</p>
 
+<p>For subroutines, the number of call arguments (args) is listed in parentheses in the <code>type</code> column. For example, <code>sub(9)</code> indicates a sub with 9 args. Subroutines whose arg count cannot easily be determined are indicated as <code>sub(*)</code>. The count does not include a leading variable named <b>$self</b> or <b>$class</b>.</p>
+
 <p>By default the table lists subroutines with more than 20 <code>code_lines</code>, but this can be changed with the following two parameters:</p>
 
-<p><b>--dump-block-minimum-lines=n</b>, or <b>-dbl=n</b>, where <b>n</b> is the minimum number of <code>code_lines</code> to be included. The default is <b>-n=20</b>. Note that <code>code_lines</code> is the number of lines excluding and comments, blanks and pod.</p>
+<p><b>--dump-block-minimum-lines=n</b>, or <b>-dbl=n</b>, where <b>n</b> is the minimum number of <code>code_lines</code> to be included. The default is <b>-n=20</b>. Note that <code>code_lines</code> is the number of lines excluding comments, blanks and pod.</p>
 
 <p><b>--dump-block-types=s</b>, or <b>-dbt=s</b>, where string <b>s</b> 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 <b>sub if elsif else for foreach ..</b>) or the word immediately before the opening brace. In addition, there are a few symbols for special block types, as follows:</p>
 
    *    - any block except nameless blocks
    +    - any nested inner block loop
    package - any package or class
-   closure - any nameless block</code></pre>
+   closure - any nameless block
+   elsif3  - an if-elsif-..-else chain with 3 or more elsif&#39;s (3 is arbitrary, see below)</code></pre>
+
+<p>A chain of <b>if-elsif-...</b> blocks may be reported as a single line item by entering the word <b>elsif</b> with an appended integer, as indicated by the last item in this list. The integer indicates the number of <b>elsif</b> blocks required for a chain to be reported. If you use this, you may want to also use <b>-dbl=n</b>, with a smaller number of lines <b>n</b> than the default.</p>
 
 <p>In addition, specific block loop types which are nested in other loops can be selected by adding a <b>+</b> after the block name. (Nested loops are sometimes good candidates for restructuring).</p>
 
 
 <pre><code>    perltidy -dbs -dbl=1 -dbt=&#39;* closure&#39; somefile.pl &gt;blocks.csv</code></pre>
 
+</li>
+<li><p>This selects every if-chain which contains 2 or more <b>elsif</b> blocks:</p>
+
+<pre><code>    perltidy -dbs -dbl=1 -dbt=&#39;elsif2&#39; somefile.pl &gt;blocks.csv</code></pre>
+
 </li>
 </ul>
 
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents perltidy version 20230912</p>
+<p>This man page documents perltidy version 20230912.04</p>
 
 <h1 id="BUG-REPORTS">BUG REPORTS</h1>
 
index 02b9b607a6ac55627b575c6e5f26861d1c65e32b..59c7386d0c4883b03300a7aa0460de81d0defa06 100644 (file)
@@ -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 {
index 3bdcae603a6f154ed275087338d739bf72acf97d..36174693641bb117a28ab089fbec33fcdf81f29b 100644 (file)
@@ -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
 
index e9b193b3dc4a49c8c891ed57d0fd4b033d4ef321..7b17eabb8b9463cc6fcc6b9f2fdc0e86ec0ff96f 100644 (file)
@@ -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{ };
index 6bf4e1ffd7d3a45f700478988d0e4b7d696f78db..c8d5f7914b5738b1022f62b6d0ff2fca11d8ecea 100644 (file)
@@ -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{};
 
index 29e5f27cfbee8b0c2f0aa7e43807ab8c9b275e41..52a5a60cb58b8e0e98500816d762f8e6d7347074 100644 (file)
@@ -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{};
index 299686aac8672750e9fc51ecef96dd2f539c98c8..0025cd883393614f090dfb365b80e6a2b7fcda96 100644 (file)
@@ -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;
index a8ba8e27a0a301cdea250a7b3c74077da39abce8..b61da89db020aa6c1064dc4b8ade83642f6efeb9 100644 (file)
@@ -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;
index 7d6b4994ff981088c36dead3dc0795c488153d73..e13f421f1d6b34b8590e675a0a936a488b3893a4 100644 (file)
@@ -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{};
index 577ec6f9819f8dea17dbbd834964efaef6f6286f..13683632ce39e2cd28b22595527251e6b76a23ef 100644 (file)
@@ -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;
 
index e40cb147354579a98071a7aa592d5fa8c6eb696a..d16dee066e3656938c420095ca53298f6701db35 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::IndentationItem;
 use strict;
 use warnings;
-our $VERSION = '20230912.03';
+our $VERSION = '20230912.04';
 
 BEGIN {
 
index a503145177648c72e2e651505b7ee4fe47ef0eaa..cea4eacc874d7fa02d885bc9ca98b16e7baad65e 100644 (file)
@@ -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;
index 3e3117026aeb9fb46878ec129eda406a96dbb31a..35ad51ef37d34c7c457f4aa7fa21f9d0a43ad8e1 100644 (file)
@@ -33,7 +33,7 @@ use strict;
 use warnings;
 use English qw( -no_match_vars );
 
-our $VERSION = '20230912.03';
+our $VERSION = '20230912.04';
 
 use Carp;
 
index 246a472f493723f4fef7c4b2ef6b5a064eaae0a7..b60129700f51a342133ae5ac3e094e4126520773 100644 (file)
@@ -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;
 
index 20de373f85a3431c2ae8582811b2584ba1327ca8..9427877a47efee47180ec07b9b2c01959cb39ff5 100644 (file)
@@ -10,7 +10,7 @@ use warnings;
 
 { #<<< A non-indenting brace
 
-our $VERSION = '20230912.03';
+our $VERSION = '20230912.04';
 
 sub new {
     my ( $class, $rarg ) = @_;
index eab9d98672695ed51f45b3c2d5c9d00087ba048a..107c52addfa3be5a4f75fcc159067232a5644d9c 100644 (file)
@@ -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 {