]> git.donarmstrong.com Git - perltidy.git/commitdiff
bump to v20240511.05 20240511.05
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 8 Jul 2024 22:40:07 +0000 (15:40 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 8 Jul 2024 22:40:07 +0000 (15:40 -0700)
20 files changed:
CHANGES.md
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 a0bb50c84b1e3f6bf8cce44bbffab9b3053df8b7..922c80f7b388eacdd35e759e583595c6c30d1081 100644 (file)
@@ -1,6 +1,6 @@
 # Perltidy Change Log
 
-## 2024 05 11.04
+## 2024 05 11.05
 
     - Add options --dump-mismatched-returns (or -dmr) and
       --warn-mismatched-returns (or -wmr).  These options report function
index ab9ce44d9312bfeccceb4fd88f6314d572eedc0b..f7849a6b6d735bfcf301184b15318287730300fb 100755 (executable)
@@ -6248,8 +6248,6 @@ means format F<somefile.pl> as usual and check for mismatched overcounts and
 undercounts but not arrows. Skip checking for any sub named C<new> or C<old>,
 and only warn of undercounts for subs expecting more than 2 args.
 
-=back
-
 =item B<Use --dump-mismatched-returns> to find function calls where the number of requested values may disagree with sub return statements
 
 The parameter B<--dump-mismatched-returns>, or B<-dmr>, examines the return
@@ -6284,7 +6282,7 @@ The three issue types are illustrated with the following code
         return ( $name, $flags );  # 2 values with 'return' statement
     }
 
-    ( $name ) = $self->info();                 # type 'u' (want 1 < 2)
+    $name = $self->info();                     # type 'u' (want 1 < 2)
     ( $name, $flags, $access) = $self->info(); # type 'o' (want 3 > 2)
 
 Issues are only reported when the return transaction involves two or more list
@@ -6327,6 +6325,8 @@ trailing B<*> on a name may be used to indicate a partial string match.
 
 =back
 
+=back
+
 =head2 B<Working with MakeMaker, AutoLoader and SelfLoader>
 
 The first $VERSION line of a file which might be eval'd by MakeMaker
@@ -6750,7 +6750,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module
 
 =head1 VERSION
 
-This man page documents perltidy version 20240511.04
+This man page documents perltidy version 20240511.05
 
 =head1 BUG REPORTS
 
index bf99bd5c25dbdda41fb0085567ecd1985a011208..5ca4fb19a0c06276c2b2119826942a8b10213be2 100644 (file)
@@ -1,15 +1,44 @@
 <h1>Perltidy Change Log</h1>
 
-<h2>2024 05 11.04</h2>
+<h2>2024 05 11.05</h2>
 
-<pre><code>- A option was added to filter unimplemented parameters from perltidy
+<pre><code>- Add options --dump-mismatched-returns (or -dmr) and
+  --warn-mismatched-returns (or -wmr).  These options report function
+  calls where the number of requested values may disagree with sub
+  return statements.  The -dump version writes the results for a single
+  file to standard output and exits:
+
+     perltidy -dmr somefile.pl &gt;results.txt
+
+  The -warn version formats as normal but reports any issues as warnings in
+  the error file:
+
+     perltidy -wmr somefile.pl
+
+  The -warn version may be customized with the following additional
+  parameters if necessary to avoid needless warnings:
+
+  --warn-mismatched-return-types=s (or -wmrt=s),
+  --warn-mismatched-return-exclusion-list=s (or -wmrxl=s)
+
+  These are explained in the manual.
+
+- Updates for issue git #151:
+  (1) --warn-variable-types=u is now okay if it is on the command line
+  with a named file.
+  (2) --warn-variable-exclusion-list=s now allows leading and/or
+  trailing * on variable names to allow a wildcard match. For example
+  -wvxl='*_unused' is okay.
+  (3) --dump-unusual-variables now outputs the filename.
+
+- A option was added to filter unimplemented parameters from perltidy
   configuration files, suggested in git #146.  If a line in the config
   file begins with three dashes followed by a parameter name
   (rather than two), then the line will be removed if the parameter is
   unknown. Otherwise, a dash will be removed to make the line valid.
 
 - Parameters --dump-mismatched-args (or -dma) and
-  --warn-mismatched-arg (or -wma) have been updated to catch more
+  --warn-mismatched-args (or -wma) have been updated to catch more
   arg count issues.
 
 - Fix issue git #143, extend -add-trailing-commas to apply to a list
@@ -107,7 +136,7 @@ my $html = $this-&gt;SUPER::genObject( $query, $bindNode, $field . ":$var",
   off by default, but it could become the default in a future version.
 
 - Add options --dump-mismatched-args (or -dma) and
-  --warn-mismatched-arg (or -wma).  These options look
+  --warn-mismatched-args (or -wma).  These options look
   for and report instances where the number of args expected by a
   sub appear to differ from the number passed to the sub.  The -dump
   version writes the results for a single file to standard output
index 12f79c0ded9f408e60f34d3c9870eae508d5affd..a4a766a868c1fa7c9ada1ccb612a67b1c0ddc13b 100644 (file)
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents Perl::Tidy version 20240511.04</p>
+<p>This man page documents Perl::Tidy version 20240511.05</p>
 
 <h1 id="LICENSE">LICENSE</h1>
 
index a66b214d7f2e033f0c30b88e7576dbc325c6f0bc..f1e3bcc9df7dc67d41de75a7cc9e8f911f8f38ab 100644 (file)
 
 <p>The &#39;u&#39; option (unused) has a limitation: it is not allowed in a <i>.perltidyrc</i> configuration file. But it can be used on the command line provided that perltidy is operating on a named file. This rule is necessary to avoid warnings when perltidy is run on small snippets of code from within an editor.</p>
 
-<p>A companion flag, <b>--warn-variable-exclusion-list=string</b>, or <b>-wvxl=string</b>, can be used to skip warning checks for a list of variable names. A leading and/or trailing &#39;*&#39; may be placed on any of these variable names to allow a partial match. For example</p>
+<p>A companion flag, <b>--warn-variable-exclusion-list=string</b>, or <b>-wvxl=string</b>, can be used to skip warning checks for a list of variable names. A leading and/or trailing &#39;*&#39; may be placed on any of these variable names to allow a partial match.</p>
 
 <p>For example,</p>
 
 <p>will format <i>somefile.pl</i> and report any arrow-type mismatches and overcount mismatches, but will skip undercount mismatches.</p>
 
 </li>
-<li><p><b>--warn-mismatched-arg-exclusion-list</b>, or <b>-wmaxl=string</b>, can be given to skip the warning checks for a list of subroutine names, entered as a quoted string of space- or comma-separated names. All subs with those names will be skipped, regardless of package.</p>
+<li><p><b>--warn-mismatched-arg-exclusion-list</b>, or <b>-wmaxl=string</b>, can be given to skip the warning checks for a list of subroutine names, entered as a quoted string of space- or comma-separated names, without a package prefix. All subs with those names will be skipped, regardless of package. A leading and/or trailing <b>*</b> on a name may be used to indicate a partial string match.</p>
 
 </li>
 <li><p><b>--warn-mismatched-arg-undercount-cutoff=n</b>, or <b>-wmauc=n</b>, can be used to avoid <b>undercount</b> warnings when the expected number of args is less than <b>n</b>. Please note that this number <b>n</b> is the number of args from the point of view of the sub definition, so an object like <code>$self</code> passed with an arrow operator counts as one arg.</p>
 
 <p>means format <i>somefile.pl</i> as usual and check for mismatched overcounts and undercounts but not arrows. Skip checking for any sub named <code>new</code> or <code>old</code>, and only warn of undercounts for subs expecting more than 2 args.</p>
 
+</dd>
+<dt id="Use---dump-mismatched-returns-to-find-function-calls-where-the-number-of-requested-values-may-disagree-with-sub-return-statements"><b>Use --dump-mismatched-returns</b> to find function calls where the number of requested values may disagree with sub return statements</dt>
+<dd>
+
+<p>The parameter <b>--dump-mismatched-returns</b>, or <b>-dmr</b>, examines the return side of sub call statements. Like all <b>--dump</b> commands, it writes its report to standard output and exits immediately. For example</p>
+
+<pre><code>    perltidy -dmr somefile.pl &gt;results.txt</code></pre>
+
+<p>Three types of issues are reported:</p>
+
+<dl>
+
+<dt id="x:-calls-requesting-values-from-a-sub-without-a-return-statement"><b>x:</b> calls requesting values from a sub without a return statement.</dt>
+<dd>
+
+</dd>
+<dt id="o:-overwant-:-the-number-of-values-wanted-by-the-caller-exceeds-the-number-returned-by-the-sub"><b>o:</b> (<b>overwant</b>): the number of values wanted by the caller exceeds the number returned by the sub.</dt>
+<dd>
+
+</dd>
+<dt id="u:-underwant-:-the-number-of-values-wanted-by-the-caller-is-less-than-the-number-returned-by-the-sub"><b>u:</b> (<b>underwant</b>): the number of values wanted by the caller is less than the number returned by the sub.</dt>
+<dd>
+
+</dd>
+</dl>
+
+<p>The three issue types are illustrated with the following code</p>
+
+<pre><code>    sub old_school {
+        ...
+        ( $name, $flags ); # 2 values but no &#39;return&#39; statement
+    }
+
+    ( $name, $flags ) = old_school();  # type &#39;x&#39; (no return stmt)
+
+    sub info {
+        ...;
+        return ( $name, $flags );  # 2 values with &#39;return&#39; statement
+    }
+
+    $name = $self-&gt;info();                     # type &#39;u&#39; (want 1 &lt; 2)
+    ( $name, $flags, $access) = $self-&gt;info(); # type &#39;o&#39; (want 3 &gt; 2)</code></pre>
+
+<p>Issues are only reported when the return transaction involves two or more list elements, and only when a specific number can be determined. Only return statements are scanned, so this analysis will not work for all programming styles. Reported issues are not necessarily errors, but they might be, or they might indicate potentially confusing code.</p>
+
+</dd>
+<dt id="Use---warn-mismatched-returns-to-issue-warnings-when-the-number-of-requested-values-may-disagree-with-sub-return-statements"><b>Use --warn-mismatched-returns</b> to issue warnings when the number of requested values may disagree with sub return statements</dt>
+<dd>
+
+<p>This is similar to the <b>-dump</b> parameter described above except that any mismatches are reported in the error file and otherwise formatting continues normally. The basic usage is</p>
+
+<pre><code>    perltidy -wmr somefile.pl</code></pre>
+
+<p>The following companion controls are available to avoid unwanted error messages:</p>
+
+<ul>
+
+<li><p><b>--warn-mismatched-return-types=s</b>, or <b>-wmrt=s</b>, can be used to limit checks.</p>
+
+<p>To restrict the checking, set the string equal to the letter(s) of that warning, any <b>x</b>, <b>o</b>, or <b>u</b>. For example</p>
+
+<pre><code>   perltidy -wmrt=&#39;x o&#39; somefile.pl</code></pre>
+
+<p>will format <i>somefile.pl</i> and report issue types <b>x</b> and <b>o</b> but not type <b>u</b>. All checks may be requested with <b>-wmrt=&#39;*&#39;</b> or <b>-wmrt=1</b>. This is the default.</p>
+
+</li>
+<li><p><b>--warn-mismatched-return-exclusion-list</b>, or <b>-wmrxl=string</b>, can be given to skip the warning checks for a list of subroutine names, entered as a quoted string of space- or comma-separated names, without a package prefix. All subs with those names will be skipped, regardless of package. A leading and/or trailing <b>*</b> on a name may be used to indicate a partial string match.</p>
+
+</li>
+</ul>
+
 </dd>
 </dl>
 
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents perltidy version 20240511.04</p>
+<p>This man page documents perltidy version 20240511.05</p>
 
 <h1 id="BUG-REPORTS">BUG REPORTS</h1>
 
index 9999db817fffe2cec9ef571e6c0f20f170bce17a..f78c017feb96ec334c0f11b71f4844a9246e7160 100644 (file)
@@ -131,7 +131,7 @@ BEGIN {
     # then the Release version must be bumped, and it is probably past time for
     # a release anyway.
 
-    $VERSION = '20240511.04';
+    $VERSION = '20240511.05';
 } ## end BEGIN
 
 sub DESTROY {
index 5043f83aa909cc844bd684b65aaaeafeeef7f87a..ca73eb986fe6e49d61ba900c3de317f53dc243f4 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 20240511.04
+This man page documents Perl::Tidy version 20240511.05
 
 =head1 LICENSE
 
index 41e8a50436ebb4556f051305eb99e39fdda3c15e..5dc59630738ddc43cd84343646798a2d61ec15fe 100644 (file)
@@ -8,7 +8,7 @@ package Perl::Tidy::Debugger;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 use constant EMPTY_STRING => q{};
 use constant SPACE        => q{ };
index ddc620586fb5557eabf141d787f9d4d0f691f570..a541e0783a6f4f34109417b711a4d651639c0a8f 100644 (file)
@@ -18,7 +18,7 @@ package Perl::Tidy::Diagnostics;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 use constant EMPTY_STRING => q{};
 
index 66a5d161c4da4a46f1be18d77ac12aa437f8e99c..ff96f9f7db22351466ba2c7d523cb7bcbd303ca4 100644 (file)
@@ -16,7 +16,7 @@
 package Perl::Tidy::FileWriter;
 use strict;
 use warnings;
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 use constant DEVEL_MODE   => 0;
 use constant EMPTY_STRING => q{};
index 41b9f6d0b1f155811f14057711548b0964576742..4c63280f4ff27678bd7bc384d57968ad4281cd17 100644 (file)
@@ -76,7 +76,7 @@ use constant BACKSLASH    => 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 = '20240511.04';
+our $VERSION = '20240511.05';
 
 # The Tokenizer will be loaded with the Formatter
 ##use Perl::Tidy::Tokenizer;    # for is_keyword()
index 6e4a3ad7a065bbeb913779dfa7c795fd1ad44180..9fa76c436a76d6e4584804defc68c951c91193f2 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::HtmlWriter;
 use strict;
 use warnings;
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 use Carp;
 use English qw( -no_match_vars );
index 3ae70c0da39f7df63d79a3530c9f4ed852c29432..8b761915053d4f99baae97c6ea1368a085786407 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 use constant DEVEL_MODE   => 0;
 use constant EMPTY_STRING => q{};
index 8c7ac042761f9dff8e79d96d38a233394a8af66b..b1d23c9159ae14dddf88f40d5d6ca288aca5a9b3 100644 (file)
@@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 use constant DEVEL_MODE => 0;
 
index 0021384768b45338b3751c053fa06e51a64c22a3..c8ba0c9e1a66c91ab3b2c4fa79b3bbdcbeab0c0b 100644 (file)
@@ -9,7 +9,7 @@ package Perl::Tidy::IndentationItem;
 use strict;
 use warnings;
 
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 BEGIN {
 
index 1aba77debe38fb7e8aeba9259b689668a49fa0ff..8fcbd6e75aeeb6cc6598123a67a587165dce16f5 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::Logger;
 use strict;
 use warnings;
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 use Carp;
 use English qw( -no_match_vars );
 
index ef5ce0b3959cbbc62e0564b1c628fa3919c6374d..16a2b1c500dfeb56c59270c513d735116f4e5e1d 100644 (file)
@@ -33,7 +33,7 @@ use strict;
 use warnings;
 use English qw( -no_match_vars );
 
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 use Carp;
 
index 9d04f438a31e6524ad092c90d7e8b8c02a840630..5ebc080b4ae3c2ab63c3a27aa35ee14d5f606c4c 100644 (file)
@@ -5,7 +5,7 @@ use Carp;
 
 { #<<< A non-indenting brace to contain all lexical variables
 
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 use English qw( -no_match_vars );
 use Scalar::Util 'refaddr';
 use Perl::Tidy::VerticalAligner::Alignment;
index 7388f12f0d7116779ac52eeed01dfd742077e1d6..b397502cf411dd8fae030bd16098996946a4ec7f 100644 (file)
@@ -9,7 +9,7 @@ package Perl::Tidy::VerticalAligner::Alignment;
 use strict;
 use warnings;
 
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 
 sub new {
     my ( $class, $rarg ) = @_;
index c5718dab2ab151cef8e1202920f2bbb82d7ccab9..4c05a4c160071f94344db6012bde34b1c8b5a131 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line;
 use strict;
 use warnings;
 
-our $VERSION = '20240511.04';
+our $VERSION = '20240511.05';
 use English qw( -no_match_vars );
 
 sub AUTOLOAD {