# 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.
=head1 VERSION
-This man page documents perltidy version 20240202.01
+This man page documents perltidy version 20240202.02
=head1 BUG REPORTS
<h1>Perltidy Change Log</h1>
-<h2>2024 02 02.01</h2>
+<h2>2024 02 02.02</h2>
-<pre><code>- Added control --delete-interbracket-arrows, or -dia, to delete optional
+<pre><code>- 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)
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents Perl::Tidy version 20240202.01</p>
+<p>This man page documents Perl::Tidy version 20240202.02</p>
<h1 id="LICENSE">LICENSE</h1>
<pre><code> # perltidy -drc:
ignoreSpec( $file, "file", \%spec, \%Rspec );</code></pre>
-<p>Since the default is not to add or delete commas, this feature is off by default and must be requested.</p>
+<p>This parameter also deletes repeated fat commas, '=>'. The complete list of actions taken when this flag is set are as follows:</p>
+
+<ul>
+
+<li><p>Repeated commas like ',,' are removed with a warning.</p>
+
+</li>
+<li><p>Repeated fat commas like '=> =>' are removed with a warning.</p>
+
+</li>
+<li><p>The combination '=>,' produces a warning but is not changed (it is likely an error but only its author would know how to fix it).</p>
+
+</li>
+<li><p>The remaining combination ',=>' (sometimes called a 'winking fat comma') is ignored by this parameter.</p>
+
+</li>
+<li><p>These warnings are only output if the <b>--warning-output</b>, or <b>-w</b>, flag is set.</p>
+
+</li>
+</ul>
+
+<p>This feature is on by default. Use <b>-ndrc</b> to turn it off.</p>
</dd>
<dt id="want-trailing-commas-s-or--wtc-s---add-trailing-commas-or--atc-and---delete-trailing-commas-or--dtc"><b>--want-trailing-commas=s</b> or <b>-wtc=s</b>, <b>--add-trailing-commas</b> or <b>-atc</b>, and <b>--delete-trailing-commas</b> or <b>-dtc</b></dt>
<dt id="r:-reused-variable-name"><b>r: reused variable name</b></dt>
<dd>
-<p>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 <b>Perl::Critic</b> policy <b>Variables::ProhibitReusedNames</b>.</p>
+<p>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 <b>Perl::Critic</b> policy <b>Variables::ProhibitReusedNames</b>.</p>
</dd>
<dt id="s:-sigil-change-but-reused-bareword"><b>s: sigil change but reused bareword</b></dt>
<dt id="u:-unused-variables"><b>u: unused variables</b></dt>
<dd>
-<p>These are variables which are declared with a <code>my</code> and not referenced again within their scope. Calling them <b>unused</b> 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. <b>But</b> sometimes they can occur due to being orphaned by a coding change, due to a misspelling, or by having an unintentional preceding <code>my</code>. 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:</p>
+<p>These are variables which are declared with a <code>my</code> and not referenced again within their scope. Calling them <b>unused</b> 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.</p>
+
+<p><b>But</b> sometimes they can occur due to being orphaned by a coding change, due to a misspelling, or by having an unintentional preceding <code>my</code>. 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:</p>
<pre><code> BEGIN { my $string = "" }
...
$string .= "ok";</code></pre>
-<p>This looks nice at first glance, but the scope of the <code>my</code> declaration is limited to the surrounding braces, so it is not the same variable as the other <code>$string</code> and must therefore be reported as unused. This problem would have also been caught by perl if the author had used <code>strict</code>.</p>
+<p>This looks nice at first glance, but the scope of the <code>my</code> declaration is limited to the surrounding braces, so it is not the same variable as the other <code>$string</code> and must therefore be reported as unused. This particular problem would have also been caught by perl if the author had used <code>strict</code>.</p>
</dd>
</dl>
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents perltidy version 20240202.01</p>
+<p>This man page documents perltidy version 20240202.02</p>
<h1 id="BUG-REPORTS">BUG REPORTS</h1>
# 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 {
valign-code
valign-block-comments
valign-side-comments
+ valign-signed-numbers
valign-signed-numbers-limit=20
short-concatenation-item-length=8
space-for-semicolon
=head1 VERSION
-This man page documents Perl::Tidy version 20240202.01
+This man page documents Perl::Tidy version 20240202.02
=head1 LICENSE
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{ };
use strict;
use warnings;
use English qw( -no_match_vars );
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
use constant EMPTY_STRING => q{};
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{};
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()
package Perl::Tidy::HtmlWriter;
use strict;
use warnings;
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
use Carp;
use English qw( -no_match_vars );
use strict;
use warnings;
use Carp;
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
use constant DEVEL_MODE => 0;
use constant EMPTY_STRING => q{};
use strict;
use warnings;
use Carp;
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
use constant DEVEL_MODE => 0;
use strict;
use warnings;
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
BEGIN {
package Perl::Tidy::Logger;
use strict;
use warnings;
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
use Carp;
use English qw( -no_match_vars );
_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,
use warnings;
use English qw( -no_match_vars );
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
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;
use strict;
use warnings;
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
sub new {
my ( $class, $rarg ) = @_;
use strict;
use warnings;
-our $VERSION = '20240202.01';
+our $VERSION = '20240202.02';
use English qw( -no_match_vars );
sub AUTOLOAD {
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 ],
];
@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 );
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...........
},
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...........
},