From: Steve Hancock Date: Mon, 8 Jul 2024 22:40:07 +0000 (-0700) Subject: bump to v20240511.05 X-Git-Tag: 20240511.05^0 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1dd6a48c651e01e2c53e7ff7c46ac65d874f0b15;p=perltidy.git bump to v20240511.05 --- diff --git a/CHANGES.md b/CHANGES.md index a0bb50c8..922c80f7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/bin/perltidy b/bin/perltidy index ab9ce44d..f7849a6b 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -6248,8 +6248,6 @@ means format F as usual and check for mismatched overcounts and undercounts but not arrows. Skip checking for any sub named C or C, and only warn of undercounts for subs expecting more than 2 args. -=back - =item B 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 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 diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index bf99bd5c..5ca4fb19 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,15 +1,44 @@

Perltidy Change Log

-

2024 05 11.04

+

2024 05 11.05

-
- A option was added to filter unimplemented parameters from perltidy
+
- 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 >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->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
diff --git a/docs/Tidy.html b/docs/Tidy.html
index 12f79c0d..a4a766a8 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20240511.04

+

This man page documents Perl::Tidy version 20240511.05

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index a66b214d..f1e3bcc9 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -4734,7 +4734,7 @@

The 'u' option (unused) has a limitation: it is not allowed in a .perltidyrc 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.

-

A companion flag, --warn-variable-exclusion-list=string, or -wvxl=string, can be used to skip warning checks for a list of variable names. A leading and/or trailing '*' may be placed on any of these variable names to allow a partial match. For example

+

A companion flag, --warn-variable-exclusion-list=string, or -wvxl=string, can be used to skip warning checks for a list of variable names. A leading and/or trailing '*' may be placed on any of these variable names to allow a partial match.

For example,

@@ -4886,7 +4886,7 @@

will format somefile.pl and report any arrow-type mismatches and overcount mismatches, but will skip undercount mismatches.

-
  • --warn-mismatched-arg-exclusion-list, or -wmaxl=string, 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.

    +
  • --warn-mismatched-arg-exclusion-list, or -wmaxl=string, 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 * on a name may be used to indicate a partial string match.

  • --warn-mismatched-arg-undercount-cutoff=n, or -wmauc=n, can be used to avoid undercount warnings when the expected number of args is less than n. Please note that this number n is the number of args from the point of view of the sub definition, so an object like $self passed with an arrow operator counts as one arg.

    @@ -4905,6 +4905,77 @@

    means format somefile.pl as usual and check for mismatched overcounts and undercounts but not arrows. Skip checking for any sub named new or old, and only warn of undercounts for subs expecting more than 2 args.

    + +
    Use --dump-mismatched-returns to find function calls where the number of requested values may disagree with sub return statements
    +
    + +

    The parameter --dump-mismatched-returns, or -dmr, examines the return side of sub call statements. Like all --dump commands, it writes its report to standard output and exits immediately. For example

    + +
        perltidy -dmr somefile.pl >results.txt
    + +

    Three types of issues are reported:

    + +
    + +
    x: calls requesting values from a sub without a return statement.
    +
    + +
    +
    o: (overwant): the number of values wanted by the caller exceeds the number returned by the sub.
    +
    + +
    +
    u: (underwant): the number of values wanted by the caller is less than the number returned by the sub.
    +
    + +
    +
    + +

    The three issue types are illustrated with the following code

    + +
        sub old_school {
    +        ...
    +        ( $name, $flags ); # 2 values but no 'return' statement
    +    }
    +
    +    ( $name, $flags ) = old_school();  # type 'x' (no return stmt)
    +
    +    sub info {
    +        ...;
    +        return ( $name, $flags );  # 2 values with 'return' statement
    +    }
    +
    +    $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 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.

    + +
    +
    Use --warn-mismatched-returns to issue warnings when the number of requested values may disagree with sub return statements
    +
    + +

    This is similar to the -dump parameter described above except that any mismatches are reported in the error file and otherwise formatting continues normally. The basic usage is

    + +
        perltidy -wmr somefile.pl
    + +

    The following companion controls are available to avoid unwanted error messages:

    + +
      + +
    • --warn-mismatched-return-types=s, or -wmrt=s, can be used to limit checks.

      + +

      To restrict the checking, set the string equal to the letter(s) of that warning, any x, o, or u. For example

      + +
         perltidy -wmrt='x o' somefile.pl
      + +

      will format somefile.pl and report issue types x and o but not type u. All checks may be requested with -wmrt='*' or -wmrt=1. This is the default.

      + +
    • +
    • --warn-mismatched-return-exclusion-list, or -wmrxl=string, 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 * on a name may be used to indicate a partial string match.

      + +
    • +
    +
    @@ -5220,7 +5291,7 @@

    VERSION

    -

    This man page documents perltidy version 20240511.04

    +

    This man page documents perltidy version 20240511.05

    BUG REPORTS

    diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 9999db81..f78c017f 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -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 { diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 5043f83a..ca73eb98 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 20240511.04 +This man page documents Perl::Tidy version 20240511.05 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 41e8a504..5dc59630 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 = '20240511.04'; +our $VERSION = '20240511.05'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index ddc62058..a541e078 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 = '20240511.04'; +our $VERSION = '20240511.05'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index 66a5d161..ff96f9f7 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 = '20240511.04'; +our $VERSION = '20240511.05'; 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 41b9f6d0..4c63280f 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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() diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index 6e4a3ad7..9fa76c43 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 = '20240511.04'; +our $VERSION = '20240511.05'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index 3ae70c0d..8b761915 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 = '20240511.04'; +our $VERSION = '20240511.05'; 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 8c7ac042..b1d23c91 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 = '20240511.04'; +our $VERSION = '20240511.05'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index 00213847..c8ba0c9e 100644 --- a/lib/Perl/Tidy/IndentationItem.pm +++ b/lib/Perl/Tidy/IndentationItem.pm @@ -9,7 +9,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20240511.04'; +our $VERSION = '20240511.05'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index 1aba77de..8fcbd6e7 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 = '20240511.04'; +our $VERSION = '20240511.05'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index ef5ce0b3..16a2b1c5 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 = '20240511.04'; +our $VERSION = '20240511.05'; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 9d04f438..5ebc080b 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -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; diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 7388f12f..b397502c 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -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 ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index c5718dab..4c05a4c1 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; -our $VERSION = '20240511.04'; +our $VERSION = '20240511.05'; use English qw( -no_match_vars ); sub AUTOLOAD {