]> git.donarmstrong.com Git - perltidy.git/commitdiff
bump version to 20240202.04 20240202.04
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 5 Apr 2024 00:05:25 +0000 (17:05 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 5 Apr 2024 00:05:25 +0000 (17:05 -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 9b0ef67440704ce6d99d03cb497eac55efd06fc8..8abcdea91391ae0cfd4036cb19d8db72b778a132 100644 (file)
@@ -1,6 +1,6 @@
 # Perltidy Change Log
 
-## 2024 02 02.03
+## 2024 02 02.04
 
     - Add options --dump-mismatched-args (or -dma) and
       --warn-mismatched-arg-types=s (or -wmat=s).  These options look
@@ -19,7 +19,7 @@
       It takes a string parameter which is 1 or '*' to activate all checks.
       It may be customized with two additional parameters if necessary to
       avoid needless warnings, --warn-mismatched-arg-exclusion-list=s and
-      --warn-mismatched-arg-count-cutoff=n. These are explained in the manual.
+      --warn-mismatched-arg-undercount-cutoff=n. These are explained in the manual.
 
     - Add option --valign-wide-equals, or -vwe, for issue git #135.
       Setting this parameter causes the following assignment operators
index b724ea3378480d4900da9b7c73bf41ddf2945037..fa0530fee644871f964573aacf89fd95c0a907c3 100755 (executable)
@@ -6584,7 +6584,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module
 
 =head1 VERSION
 
-This man page documents perltidy version 20240202.03
+This man page documents perltidy version 20240202.04
 
 =head1 BUG REPORTS
 
index 3a92e8857e01a7999a8e6b720f34a749d985c630..1ff1d15fee53c5ecb4d2a6e73244fedbf2ef4f7d 100644 (file)
@@ -1,8 +1,27 @@
 <h1>Perltidy Change Log</h1>
 
-<h2>2024 02 02.03</h2>
+<h2>2024 02 02.04</h2>
 
-<pre><code>- Add option --valign-wide-equals, or -vwe, for issue git #135.
+<pre><code>- Add options --dump-mismatched-args (or -dma) and
+  --warn-mismatched-arg-types=s (or -wmat=s).  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
+  and exits:
+
+     perltidy -dma somefile.pl &gt;results.txt
+
+  The -warn version formats as normal but reports any issues as warnings in
+  the error file:
+
+     perltidy -wmat=1 somefile.pl
+
+  It takes a string parameter which is 1 or '*' to activate all checks.
+  It may be customized with two additional parameters if necessary to
+  avoid needless warnings, --warn-mismatched-arg-exclusion-list=s and
+  --warn-mismatched-arg-undercount-cutoff=n. These are explained in the manual.
+
+- Add option --valign-wide-equals, or -vwe, for issue git #135.
   Setting this parameter causes the following assignment operators
 
      = **= += *= &amp;= &lt;&lt;= &amp;&amp;= -= /= |= &gt;&gt;= ||= //= .= %= ^= x=
         $str             .= $rfields-&gt;[$j];
         $str_len         += $rfield_lengths-&gt;[$j];
 
-  This option currently is off by default to avoid changing existing formatting.
+  This option currently is off by default to avoid changing existing
+  formatting.
+
+- Previously, a line break was made before a short concatenated terminal
+  quoted string, such as "\n", if the previous line had a greater
+  starting indentation. The break is now placed after the short quote.
+  This keeps code a little more compact. For example:
+
+# old rule: break before "\n" here because '$name' has more indentation:
+my $html = $this-&gt;SUPER::genObject( $query, $bindNode, $field . ":$var",
+    $name, "remove", "UNCHECKED" )
+  . "\n";
+
+# new rule: break after a short terminal quote like "\n" for compactness;
+my $html = $this-&gt;SUPER::genObject( $query, $bindNode, $field . ":$var",
+    $name, "remove", "UNCHECKED" ) . "\n";
 
 - In the option --dump-block-summary, the number of sub arguments indicated
   for each sub now includes any leading object variable passed with
@@ -1466,7 +1500,7 @@ signatures.  Reformatting with the current version will fix the problem.
 - fixed issue git#13, needless trailing whitespace in error message
 
 - fixed issue git#9: if the -ce (--cuddled-else) flag is used,
-  do not try to form new one line blocks for a block type 
+  do not try to form new one line blocks for a block type
   specified with -cbl, particularly map, sort, grep
 
 - iteration speedup for unchanged code.  Previously, when iterations were
index 8d90e8476ba28a7dc857e61c0ee6b390535bc2fd..7bc312c8cc990a59b3172091a3cdab36a52aa3d6 100644 (file)
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents Perl::Tidy version 20240202.03</p>
+<p>This man page documents Perl::Tidy version 20240202.04</p>
 
 <h1 id="LICENSE">LICENSE</h1>
 
index 2ed0d8467b6e63311ba357355489a5ab4ea18741..b2378de51d5dbd0619edad24a5039f0288c92c9b 100644 (file)
         [  10.9,        10.9,             11 ],
     );</code></pre>
 
-<p>The current default alignment is strict left justification:</p>
+<p>The default is <b>-vsn</b>. This can be turned off to get is strict left justification:</p>
 
 <pre><code>    # perltidy -nvsn
     my @correct = (
         [ 10.9,        10.9,             11 ],
     );</code></pre>
 
-<p>In a future release <b>-vsn</b> will become the default.</p>
-
 <p>Some points regarding <b>-vsn</b> are:</p>
 
 <ul>
 <li><p>This option is mainly limited to lists of comma-separated numbers. For multiline lists of numbers, having trailing commas can sometimes improve the results. If missing, perltidy can add them for example with parameters <b>-wtc=b -atc</b>. See <a href="#Adding-and-Deleting-Commas">&quot;Adding and Deleting Commas&quot;</a>.</p>
 
 </li>
-<li><p>This option has a control parameter <b>--valign-signed-number-limit=N</b>, or <b>-vsnl=N</b>. This value controls formatting of very long columns of numbers and should not normally need to be changed. To see its purpose, consider a very long column of just unsigned numbers, say 1000 lines. If we add a single negative number, it is undesirable to move all of the other numbers over by one space. This would create many lines of file differences but not really improve the appearance when a local section of the table was viewed. The number <b>N</b> avoids this problem by not adding extra indentation to a run of more than <b>N</b> lines of unsigned numbers. The default value, <b>N=20</b>, is set to be a number of lines for which the ends of a long column of unsigned numbers are not normally both in view.</p>
+<li><p>This option has a control parameter <b>--valign-signed-number-limit=N</b>, or <b>-vsnl=N</b>. This value controls formatting of very long columns of numbers and should not normally need to be changed. To see its purpose, consider a very long column of just unsigned numbers, say 1000 lines. If we add a single negative number, it is undesirable to move all of the other numbers over by one space. This could create many lines of file differences but not really improve the appearance when a local section of the table was viewed. The number <b>N</b> avoids this problem by not adding extra indentation to a run of more than <b>N</b> lines of unsigned numbers. The default value, <b>N=20</b>, is set to be a number of lines for which the ends of a long column of unsigned numbers are not normally both in view.</p>
 
 </li>
 </ul>
 
 <p>Otherwise, the <code>||</code> will operate on <code>$infile</code> rather than the return value of <code>open</code>.</p>
 
+</dd>
+<dt id="Use---dump-mismatched-args-to-find-function-calls-with-args-not-matching-sub-declarations"><b>Use --dump-mismatched-args to find function calls with args not matching sub declarations</b></dt>
+<dd>
+
+<p>The parameter <b>--dump-mismatched-args</b>, or <b>-dma</b>, causes perltidy to examine the definitions of subroutines in a file, and calls to those subs, and report any apparent differences. Like all <b>--dump</b> commands, it writes its report to standard output and exits immediately. For example</p>
+
+<pre><code>    perltidy -dma somefile.pl &gt;results.txt</code></pre>
+
+<p>Two types of issues are reported, types <b>a</b> and <b>c</b>:</p>
+
+<dl>
+
+<dt id="a:-calls-made-to-a-sub-both-with-and-without-the-arrow-operator"><b>a:</b> calls made to a sub both with and without the <b>arrow</b> operator</dt>
+<dd>
+
+<p>For example the following two lines would be reported as a mismatch:</p>
+
+<pre><code>     Fault();</code></pre>
+
+<p>and</p>
+
+<pre><code>     $self-&gt;Fault();</code></pre>
+
+<p>This may or may not be an error, but it is worth checking.</p>
+
+</dd>
+<dt id="c:-the-count-of-call-args-differs-from-a-sub-definition"><b>c:</b> the <b>count</b> of call args differs from a sub definition</dt>
+<dd>
+
+<p>If a sub appears to expect a specific number of args, and is called with more or less than this number, then a mismatch will be reported. For example</p>
+
+<pre><code>     sub do_something {
+         my $self=shift;
+         my ($v1,$v2)=@_;
+         ...
+     }
+
+    $self-&gt;do_something(43);</code></pre>
+
+<p>In this case, the sub is expecting a total of three args (<code>$self</code>, <code>$v1</code>, and <code>$v2</code>) but only receives two (<code>$self</code> and <code>42</code>), so a mismatch is reported. This is not necessarily an error because the sub may allow for this possibility. This sometimes happens as a code evolves to have new functionality. But it can be a source of confusion, and it could be an error, so it is worth checking.</p>
+
+</dd>
+</dl>
+
+<p><b>Some Limitations:</b></p>
+
+<ul>
+
+<li><p>Only subs for which the call args are unpacked in an orderly manner at the beginning of the sub from <code>@_</code>, directly and/or with <code>shift</code> operations, are checked. Subs for which this does not appear to be the case are skipped.</p>
+
+</li>
+<li><p>Subs which appear to have no args are not checked. This is necessary to avoid false warnings when a sub actually uses args in a complex way.</p>
+
+</li>
+<li><p>Only calls which appear to be to subs defined within the file are checked.</p>
+
+</li>
+<li><p>Sub calls made without parentheses around the args are not checked.</p>
+
+</li>
+<li><p>Anonymous subs and lexical subs (introduced with &#39;my&#39;) are not currently checked.</p>
+
+</li>
+</ul>
+
+</dd>
+<dt id="Use---warn-mismatched-arg-types-s-to-produce-a-warning-for-function-calls-with-args-not-matching-sub-declarations"><b>Use --warn-mismatched-arg-types=s to produce a warning for function calls with args not matching sub declarations</b></dt>
+<dd>
+
+<p>The parameter <b>--warn-mismatched-arg-types=s</b>, or <b>-wmat=s</b>, can be used to produce a warning message when perltidy formats a file and certain of the above mismatchs is detected during formatting. Both checks may be requested with <b>-wmat=&#39;*&#39;</b> or <b>-wmat=1</b>.</p>
+
+<p>The default is not to do any of these checks, which can also be indicated with <b>-wmat=0</b>.</p>
+
+<p>To restrict the check to a specific warning type, set the string equal to the letter of that warning, either <b>a</b> or <b>c</b>. For example</p>
+
+<pre><code>   perltidy -wmat=&#39;c&#39; somefile.pl</code></pre>
+
+<p>will format <i>somefile.pl</i> and report any call arg count mismatches found but will skip checking for arrow-type mismatches.</p>
+
+<p>A companion control parameter <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.</p>
+
+<p>Another control parameter <b>--warn-mismatched-arg-undercount-cutoff=n</b>, or <b>-wmauc=n</b>, can be used to avoid undercount warnings when the number of args expected is <b>n</b> or less. 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>The default value is <b>n=4</b>. This has been found to allow most programs to pass without warnings, but it should be reduced if possible for better error checking. The minimum possible value of <b>n</b> for a program can be determined by running with -wmauc=0, or by running the -dump version. The output shows, for each mismatch, the number of args expected by a sub plus the range of the number of args actually passed to it.</p>
+
+<p>For example</p>
+
+<pre><code>   perltidy -wmat=&#39;*&#39; -wmaxl=&#39;new&#39; -wmauc=2 somefile.pl</code></pre>
+
+<p>means format <i>somefile.pl</i> as usual and check for all mismatch types. But skip checking for any sub named <code>new</code>, and only warn of undercounts for subs expecting more than 2 args.</p>
+
 </dd>
 </dl>
 
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents perltidy version 20240202.03</p>
+<p>This man page documents perltidy version 20240202.04</p>
 
 <h1 id="BUG-REPORTS">BUG REPORTS</h1>
 
index 31a1e1b4767b7e54bd1cb5930c8aa78ece4c94a2..1d710ea0ec1bba5f6df200318e85244491c654b2 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 = '20240202.03';
+    $VERSION = '20240202.04';
 } ## end BEGIN
 
 sub DESTROY {
index 98fc5cafeeb396b287f83ce407ca40ae583cf48e..c68734e67db888b6387163207bab08a2d40a14ab 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 20240202.03
+This man page documents Perl::Tidy version 20240202.04
 
 =head1 LICENSE
 
index d129f81a3c37845976b2044223b40675a0911106..1cdad317e2e32d042291496368a897fc3b00866b 100644 (file)
@@ -8,7 +8,7 @@ package Perl::Tidy::Debugger;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 use constant EMPTY_STRING => q{};
 use constant SPACE        => q{ };
index 872b154dd00ea41b0d2872fcfcb706159804ccc6..902d382f786ba4d6e535ec094669d350a97a6ff8 100644 (file)
@@ -18,7 +18,7 @@ package Perl::Tidy::Diagnostics;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 use constant EMPTY_STRING => q{};
 
index 0e925db169dc12104cad8d7586619bf6b0e5eb89..febd62400565d0b2bf563b37cdf4ed02bc1e7c5a 100644 (file)
@@ -16,7 +16,7 @@
 package Perl::Tidy::FileWriter;
 use strict;
 use warnings;
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 use constant DEVEL_MODE   => 0;
 use constant EMPTY_STRING => q{};
index 49b4e27dd588479feafdbdce1771d80103c32f30..3ff52c6362dbabd1461a36a7a894814a3c7fe2cc 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 = '20240202.03';
+our $VERSION = '20240202.04';
 
 # The Tokenizer will be loaded with the Formatter
 ##use Perl::Tidy::Tokenizer;    # for is_keyword()
index c19d26020ae337e81be1c4d12a51ce63469696c1..febf10a4c1ed879d91a93e9167ec25d0f046a55f 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::HtmlWriter;
 use strict;
 use warnings;
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 use Carp;
 use English qw( -no_match_vars );
index 2da04ed5bd08a0f1d1b6e9a1392df58826f8b1bf..62b67cf3be73fa72357329f7fa9db32f2907c9cf 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 use constant DEVEL_MODE   => 0;
 use constant EMPTY_STRING => q{};
index 8673452349c8ff326bab22ec8cddd1f898e4f48f..9eb6b78fb13f93027c20e47086f07e469fcce936 100644 (file)
@@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 use constant DEVEL_MODE => 0;
 
index 9fbabbabad58d8a2b07c0a93255b8dc8a42a2690..f4e505ac963d3bb1b7cf5d9e52b3ca4b6063e3b9 100644 (file)
@@ -9,7 +9,7 @@ package Perl::Tidy::IndentationItem;
 use strict;
 use warnings;
 
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 BEGIN {
 
index d5cd16eee44652dbc1a93a22af47bf81aaf2656d..8493f09a678576dad1ed7a3ab72f5dd150121251 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::Logger;
 use strict;
 use warnings;
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 use Carp;
 use English qw( -no_match_vars );
 
index 809cd2c41e1bab590cc658c786501fd30a46152f..12295be5ef84b7e4c610465ee9925986049171e3 100644 (file)
@@ -33,7 +33,7 @@ use strict;
 use warnings;
 use English qw( -no_match_vars );
 
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 use Carp;
 
index 8767950d821b42ac0d3412fcc87946b85561fb9c..92be8366e3d13210772c37fc9e22d029f72aa321 100644 (file)
@@ -5,7 +5,7 @@ use Carp;
 
 { #<<< A non-indenting brace to contain all lexical variables
 
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 use English qw( -no_match_vars );
 use Scalar::Util 'refaddr';
 use Perl::Tidy::VerticalAligner::Alignment;
index f15ad97b1bc0d9c95878a8bbaef2c4ff869335f5..1d5069b9cf4f75988529edcabd7d51319dd31be9 100644 (file)
@@ -9,7 +9,7 @@ package Perl::Tidy::VerticalAligner::Alignment;
 use strict;
 use warnings;
 
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 
 sub new {
     my ( $class, $rarg ) = @_;
index 480b7b4461d4ec9a722245aa8a74df4ca34ee318..0bd8c66c8a884d054259ea6af2ac6c8f5af2e7c2 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line;
 use strict;
 use warnings;
 
-our $VERSION = '20240202.03';
+our $VERSION = '20240202.04';
 use English qw( -no_match_vars );
 
 sub AUTOLOAD {