From 205d97b8166e783d2c3c9078d2c9487f13684c0c Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sat, 17 Feb 2024 16:37:04 -0800 Subject: [PATCH] -vsn is now default; bump version to .02 --- CHANGES.md | 8 +++++- bin/perltidy | 2 +- docs/ChangeLog.html | 22 +++++++++++++-- docs/Tidy.html | 2 +- docs/perltidy.html | 33 ++++++++++++++++++---- lib/Perl/Tidy.pm | 3 +- 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 | 2 +- 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 | 4 +-- 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 +- t/snippets/expect/math1.def | 12 ++++---- t/snippets/expect/vsn.def | 16 +++++------ t/snippets29.t | 16 +++++------ t/snippets5.t | 12 ++++---- 24 files changed, 102 insertions(+), 54 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4ecc53fc..a04f9c12 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,12 @@ # Perltidy Change Log -## 2024 02 02.01 +## 2024 02 02.02 + + - The option --valign-signed-numbers, or -vsn is now the default. It + was introduced in the previous release has been found to significantly + improve the overall appearance of columns of signed and unsigned + numbers. It will change formatting slightly in scripts with columns + of vertically aligned numbers, and can be deactivated with -nvsn. - The option --delete-repeated-commas is now the default. diff --git a/bin/perltidy b/bin/perltidy index c6853af9..c78b65b9 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -6446,7 +6446,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20240202.01 +This man page documents perltidy version 20240202.02 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index 06bb8f69..1cfaee63 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,8 +1,26 @@

Perltidy Change Log

-

2024 02 02.01

+

2024 02 02.02

-
- Added control --delete-interbracket-arrows, or -dia, to delete optional
+
- The option --valign-signed-numbers, or -vsn is now the default. It
+  was introduced in the previous release has been found to significantly
+  improve the overall appearance of columns of signed and unsigned
+  numbers.  It will change formatting slightly in scripts with columns
+  of vertically aligned numbers, and can be deactivated with -nvsn.
+
+- The option --delete-repeated-commas is now the default.
+
+  It makes the following checks and changes:
+  - Repeated commas like ',,' are removed with a warning
+  - Repeated fat commas like '=> =>' are removed with a
+    warning
+  - The combination '=>,' produces a warning but is not changed
+  These warnings are only output if --warning-output, or -w, is set.
+
+  This is now the DEFAULT Behavior.
+  Use --nodelete-repeated-commas, or -ndrc, to turn this option off.
+
+- Added control --delete-interbracket-arrows, or -dia, to delete optional
   hash ref and array ref arrows between brackets as in the following
   expression (see git #131)
 
diff --git a/docs/Tidy.html b/docs/Tidy.html
index ee566e75..a2431beb 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20240202.01

+

This man page documents Perl::Tidy version 20240202.02

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index 4ec28cfe..2ce87b96 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -2951,7 +2951,28 @@
      # perltidy -drc:
       ignoreSpec( $file, "file", \%spec, \%Rspec );
-

Since the default is not to add or delete commas, this feature is off by default and must be requested.

+

This parameter also deletes repeated fat commas, '=>'. The complete list of actions taken when this flag is set are as follows:

+ +
    + +
  • Repeated commas like ',,' are removed with a warning.

    + +
  • +
  • Repeated fat commas like '=> =>' are removed with a warning.

    + +
  • +
  • The combination '=>,' produces a warning but is not changed (it is likely an error but only its author would know how to fix it).

    + +
  • +
  • The remaining combination ',=>' (sometimes called a 'winking fat comma') is ignored by this parameter.

    + +
  • +
  • These warnings are only output if the --warning-output, or -w, flag is set.

    + +
  • +
+ +

This feature is on by default. Use -ndrc to turn it off.

--want-trailing-commas=s or -wtc=s, --add-trailing-commas or -atc, and --delete-trailing-commas or -dtc
@@ -4577,7 +4598,7 @@
r: reused variable name
-

These are variables which are re-declared in the scope of a variable with the identical name. This can be confusing (perhaps not when the code is first written, but possibly later during maintenance work). This issue can be avoided by renaming one of the conflicting variables. Note that this is similar to the Perl::Critic policy Variables::ProhibitReusedNames.

+

These are variables which are re-declared in the scope of a variable with the identical name. This can be confusing, perhaps not when the code is first written, but possibly later during maintenance work. For example, this can make it difficult to locate the correct variable with an editor when changes are being made. This issue can be avoided by renaming one of the conflicting variables. Note that this is similar to the Perl::Critic policy Variables::ProhibitReusedNames.

s: sigil change but reused bareword
@@ -4605,13 +4626,15 @@
u: unused variables
-

These are variables which are declared with a my and not referenced again within their scope. Calling them unused is convenient but not really accurate; this is a "gray area" for a program. There are many reasons for having such variables. For example, they might occur in a list of values provided by another routine or data structure, and therefore must be listed, even though they might not be referenced again. Or they might be defined for possible future program development, clarity or debugging. But sometimes they can occur due to being orphaned by a coding change, due to a misspelling, or by having an unintentional preceding my. So it is worth reviewing them, especially for new code. Here is an example of an unused variable in a script located with this method:

+

These are variables which are declared with a my and not referenced again within their scope. Calling them unused is convenient but not really accurate; this is a "gray area" for a program. There are some good reasons for having such variables. For example, they might occur in a list of values provided by another routine or data structure, and therefore must be listed, even though they might not be referenced again. Having such variables can make them immediately available for future development and debugging, and can be beneficial for program clarity.

+ +

But sometimes they can occur due to being orphaned by a coding change, due to a misspelling, or by having an unintentional preceding my. So it is worth reviewing them, especially for new code. Here is an example of an unused variable in a script located with this method:

   BEGIN { my $string = "" }
    ...
    $string .= "ok";
-

This looks nice at first glance, but the scope of the my declaration is limited to the surrounding braces, so it is not the same variable as the other $string and must therefore be reported as unused. This problem would have also been caught by perl if the author had used strict.

+

This looks nice at first glance, but the scope of the my declaration is limited to the surrounding braces, so it is not the same variable as the other $string and must therefore be reported as unused. This particular problem would have also been caught by perl if the author had used strict.

@@ -5009,7 +5032,7 @@

VERSION

-

This man page documents perltidy version 20240202.01

+

This man page documents perltidy version 20240202.02

BUG REPORTS

diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index b8abb0a0..622b22d1 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 = '20240202.01'; + $VERSION = '20240202.02'; } ## end BEGIN sub DESTROY { @@ -3887,6 +3887,7 @@ sub generate_options { valign-code valign-block-comments valign-side-comments + valign-signed-numbers valign-signed-numbers-limit=20 short-concatenation-item-length=8 space-for-semicolon diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 9c690ef6..19c7c81a 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 20240202.01 +This man page documents Perl::Tidy version 20240202.02 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 9f23e2fe..9f245bac 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 = '20240202.01'; +our $VERSION = '20240202.02'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index fe84bf06..c1bdc27b 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 = '20240202.01'; +our $VERSION = '20240202.02'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index fd3f4e32..92a69aad 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 = '20240202.01'; +our $VERSION = '20240202.02'; 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 7393537d..c4282370 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 = '20240202.01'; +our $VERSION = '20240202.02'; # 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 5a9a0adb..af1e5194 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 = '20240202.01'; +our $VERSION = '20240202.02'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index 45895456..9006e755 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 = '20240202.01'; +our $VERSION = '20240202.02'; 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 0d787877..418ec88f 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 = '20240202.01'; +our $VERSION = '20240202.02'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index b6d2fc10..c9a95069 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 = '20240202.01'; +our $VERSION = '20240202.02'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index 6301109a..87594988 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 = '20240202.01'; +our $VERSION = '20240202.02'; use Carp; use English qw( -no_match_vars ); @@ -105,7 +105,7 @@ sub new { _complaint_count => 0, _is_encoded_data => $is_encoded_data, _saw_code_bug => -1, # -1=no 0=maybe 1=for sure - _saw_brace_error => 0, + _saw_brace_error => 0, _output_array => [], _input_stream_name => $input_stream_name, _filename_stamp => $filename_stamp, diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index b7cc49fa..a130b81f 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 = '20240202.01'; +our $VERSION = '20240202.02'; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index d4915353..897475a1 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 = '20240202.01'; +our $VERSION = '20240202.02'; use English qw( -no_match_vars ); 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 9c88cdd1..a88cc800 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 = '20240202.01'; +our $VERSION = '20240202.02'; sub new { my ( $class, $rarg ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index 447a929d..fc29e085 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 = '20240202.01'; +our $VERSION = '20240202.02'; use English qw( -no_match_vars ); sub AUTOLOAD { diff --git a/t/snippets/expect/math1.def b/t/snippets/expect/math1.def index 7d5fe399..4cc08de7 100644 --- a/t/snippets/expect/math1.def +++ b/t/snippets/expect/math1.def @@ -1,10 +1,10 @@ my $xyz_shield = [ [ -0.060, -0.060, 0. ], - [ 0.060, -0.060, 0. ], - [ 0.060, 0.060, 0. ], - [ -0.060, 0.060, 0. ], + [ 0.060, -0.060, 0. ], + [ 0.060, 0.060, 0. ], + [ -0.060, 0.060, 0. ], [ -0.0925, -0.0925, 0.092 ], - [ 0.0925, -0.0925, 0.092 ], - [ 0.0925, 0.0925, 0.092 ], - [ -0.0925, 0.0925, 0.092 ], + [ 0.0925, -0.0925, 0.092 ], + [ 0.0925, 0.0925, 0.092 ], + [ -0.0925, 0.0925, 0.092 ], ]; diff --git a/t/snippets/expect/vsn.def b/t/snippets/expect/vsn.def index d2f785c3..23d16912 100644 --- a/t/snippets/expect/vsn.def +++ b/t/snippets/expect/vsn.def @@ -1,12 +1,12 @@ @data = ( [ "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th" ], - [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4 ], - [ -4, -3, 1, 1, -3, -1.5, -2, -1, 0 ], - [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3 ], - [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4 ], + [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4 ], + [ -4, -3, 1, 1, -3, -1.5, -2, -1, 0 ], + [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3 ], + [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4 ], ); -$s->drawLine( 35, 0 ); -$s->drawLine( 0, 10 ); -$s->drawLine( -35, 0 ); -$s->drawLine( 0, -10 ); +$s->drawLine( 35, 0 ); +$s->drawLine( 0, 10 ); +$s->drawLine( -35, 0 ); +$s->drawLine( 0, -10 ); diff --git a/t/snippets29.t b/t/snippets29.t index 64c55bd2..cfe5767b 100644 --- a/t/snippets29.t +++ b/t/snippets29.t @@ -109,16 +109,16 @@ sub Sub( $x, $y ); expect => <<'#2...........', @data = ( [ "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th" ], - [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4 ], - [ -4, -3, 1, 1, -3, -1.5, -2, -1, 0 ], - [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3 ], - [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4 ], + [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4 ], + [ -4, -3, 1, 1, -3, -1.5, -2, -1, 0 ], + [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3 ], + [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4 ], ); -$s->drawLine( 35, 0 ); -$s->drawLine( 0, 10 ); -$s->drawLine( -35, 0 ); -$s->drawLine( 0, -10 ); +$s->drawLine( 35, 0 ); +$s->drawLine( 0, 10 ); +$s->drawLine( -35, 0 ); +$s->drawLine( 0, -10 ); #2........... }, diff --git a/t/snippets5.t b/t/snippets5.t index 3ada9017..f1cde6c2 100644 --- a/t/snippets5.t +++ b/t/snippets5.t @@ -810,13 +810,13 @@ print JUNK ("<","&",">")[rand(3)];# make these a bit more likely expect => <<'#12...........', my $xyz_shield = [ [ -0.060, -0.060, 0. ], - [ 0.060, -0.060, 0. ], - [ 0.060, 0.060, 0. ], - [ -0.060, 0.060, 0. ], + [ 0.060, -0.060, 0. ], + [ 0.060, 0.060, 0. ], + [ -0.060, 0.060, 0. ], [ -0.0925, -0.0925, 0.092 ], - [ 0.0925, -0.0925, 0.092 ], - [ 0.0925, 0.0925, 0.092 ], - [ -0.0925, 0.0925, 0.092 ], + [ 0.0925, -0.0925, 0.092 ], + [ 0.0925, 0.0925, 0.092 ], + [ -0.0925, 0.0925, 0.092 ], ]; #12........... }, -- 2.39.5