# Perltidy Change Log
-## 2021 07 17.04
+## 2021 10 29
- No significant bugs have been found since the last release, but several
minor issues have been fixed. Vertical alignment has been improved for
Added parameters -vc -vsc -vbc for separately turning off vertical
alignment of code, side comments and block comments.
- - Fixed problem where a blank line following a closing code-skipping
- comment, '#>>V', can be lost. A workaround for the previous version
- is to include the parameter '-mbl=2'.
+ - Fixed issue git #68, where a blank line following a closing code-skipping
+ comment, '#>>V', could be lost.
- This version runs 10 to 15 percent faster on large files than the
previous release due to optimizations made with the help of NYTProf.
- - Robustness of perltidy is high. This version was subjected to many
- cpu hours of testing with random input parameters. No instabilities,
- internal fault checks, undefined variable references or other
- irregularities were seen.
+ - This version of perltidy was stress-tested for many cpu hours with
+ random input parameters. No instabilities, internal fault checks,
+ undefined variable references or other irregularities were seen.
- Numerous minor fixes have been made, mostly very rare formatting instabilities
found in random testing. An effort has been made to minimize changes to
examples/filter_example.in
examples/filter_example.pl
examples/find_naughty.pl
-examples/fix-scbb-csc-bug.pl
examples/lextest
examples/perlcomment.pl
examples/perllinetype.pl
Besides flattening lists, this parameter also applies to lines broken
at certain logical breakpoints such as 'if' and 'or'.
-The length of the lines produced in this way are only limited by the
-value of the parameter B<--maximum-line-length>.
+Even if this is parameter is not used globally, it provides a convenient way to
+flatten selected lists from within an editor.
=item B<-kis>, B<--keep-interior-semicolons>
=head1 VERSION
-This man page documents perltidy version 20210717.04
+This man page documents perltidy version 20211029
=head1 BUG REPORTS
<dl>
+<dt id="Fix-c090-inconsistent-warning-messages-for-deprecated-syntax"><b>Fix c090, inconsistent warning messages for deprecated syntax</b></dt>
+<dd>
+
+<p>For something like the following snippet, a warning about deprecated syntax was either going into the error file or the log file, depending on formatting. This has been fixed.</p>
+
+<pre><code> do $roff ( &verify($tpage) );</code></pre>
+
+<p>20 Oct 2021.</p>
+
+</dd>
+<dt id="Fix-c091-incorrect-closing-side-comment"><b>Fix c091, incorrect closing side comment</b></dt>
+<dd>
+
+<p>An error was discovered and corrected in the behavior of the --closing-side-comment (-csc) flag when only subs were being marked with the setting -cscl='sub'. The problem was that in rare cases a closing paren could be marked with '## end'. The cause of the problem is that the pattern matching regex which was generated for this case happens to match an empty string, and it could happen that certain parens had empty strings as block names. This was fixed in two ways. First, the regex was fixed so that it cannot match an empty string. Second, a test for an empty string was added.</p>
+
+<p>20 Oct 2021.</p>
+
+</dd>
<dt id="Issue-c089-improve-vertical-alignment-for-lists-without-parens"><b>Issue c089, improve vertical alignment for lists without parens</b></dt>
<dd>
is $av->[5], "peep:$unop", "...with correct 'o' param";
is $av->[6], "oldop:$kid", "...and correct 'oldop' param";</code></pre>
-<p>17 Oct 2021.</p>
+<p>20 Oct 2021, 1dffec5.</p>
</dd>
<dt id="Issue-c087-breaking-after-anonymous-sub"><b>Issue c087, breaking after anonymous sub</b></dt>
<h1>Perltidy Change Log</h1>
-<h2>2021 07 17.04</h2>
-
-<pre><code>- Added two new parameters to control the block types to which the
+<h2>2021 10 29</h2>
+
+<pre><code>- No significant bugs have been found since the last release, but several
+ minor issues have been fixed. Vertical alignment has been improved for
+ lists of call args which are not contained within parens (next item).
+
+- Vertical alignment of function calls without parens has been improved with
+ the goal of making vertical alignment essentially the same with or
+ without parens around the call args. Some examples:
+
+ # OLD
+ mkTextConfig $c, $x, $y, -anchor => 'se', $color;
+ mkTextConfig $c, $x + 30, $y, -anchor => 's', $color;
+ mkTextConfig $c, $x + 60, $y, -anchor => 'sw', $color;
+ mkTextConfig $c, $x, $y + 30, -anchor => 'e', $color;
+
+ # NEW
+ mkTextConfig $c, $x, $y, -anchor => 'se', $color;
+ mkTextConfig $c, $x + 30, $y, -anchor => 's', $color;
+ mkTextConfig $c, $x + 60, $y, -anchor => 'sw', $color;
+ mkTextConfig $c, $x, $y + 30, -anchor => 'e', $color;
+
+ # OLD
+ is id_2obj($id), undef, "unregistered object not retrieved";
+ is scalar keys %$ob_reg, 0, "object registry empty";
+ is register($obj), $obj, "object returned by register";
+ is scalar keys %$ob_reg, 1, "object registry nonempty";
+ is id_2obj($id), $obj, "registered object retrieved";
+
+ # NEW
+ is id_2obj($id), undef, "unregistered object not retrieved";
+ is scalar keys %$ob_reg, 0, "object registry empty";
+ is register($obj), $obj, "object returned by register";
+ is scalar keys %$ob_reg, 1, "object registry nonempty";
+ is id_2obj($id), $obj, "registered object retrieved";
+
+ This will cause some changes in alignment, hopefully for the better,
+ particularly in test code which often uses numerous parenless function
+ calls with functions like 'ok', 'is', 'is_deeply', ....
+
+- Two new parameters were added to control the block types to which the
-bl (--opening-brace-on-new-line) flag applies. The new parameters are
-block-left-list=s, or -bll=s, and --block-left-exclusion-list=s,
or -blxl=s. Previously the -bl flag was 'hardwired' to apply to
the controls. If you want to recover the exact previous default behavior of
the -bli then add the -bl flag.
-- Partial fix issue for git #74, the -lp formatting style was
+- A partial fix was made for issue for git #74. The -lp formatting style was
being lost when a one-line anonymous sub was followed by a closing brace.
-- Fix issue git #73, the -nfpva flag was not working correctly.
+- Fixed issue git #73, in which the -nfpva flag was not working correctly.
Some unwanted vertical alignments of spaced function perens
were being made.
Added parameters -vc -vsc -vbc for separately turning off vertical
alignment of code, side comments and block comments.
-- Fixed problem where a blank line following a closing code-skipping
- comment, '#>>V', can be lost. A workaround for the previous version
- is to include the parameter '-mbl=2'.
+- Fixed issue git #68, where a blank line following a closing code-skipping
+ comment, '#>>V', could be lost.
- This version runs 10 to 15 percent faster on large files than the
previous release due to optimizations made with the help of NYTProf.
-- This version was subjected to over 100 cpu hours of testing with random input
- parameters with no instabilities or other irregularities seen.
+- This version of perltidy was stress-tested for many cpu hours with
+ random input parameters. No instabilities, internal fault checks,
+ undefined variable references or other irregularities were seen.
- Numerous minor fixes have been made, mostly very rare formatting instabilities
- found in random testing. A complete list is at:
+ found in random testing. An effort has been made to minimize changes to
+ existing formatting that these fixes produce, but occasional changes
+ may occur. Many of these updates are listed at:
https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
</code></pre>
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents Perl::Tidy version 20210717.04</p>
+<p>This man page documents Perl::Tidy version 20211029</p>
<h1 id="LICENSE">LICENSE</h1>
<p>Use this flag to tell perltidy to ignore existing line breaks to the maximum extent possible. This will tend to produce the longest possible containers, regardless of type, which do not exceed the line length limit. But please note that this parameter has priority over all other parameters requesting that certain old breakpoints be kept.</p>
+<p>To illustrate, consider the following input text:</p>
+
+<pre><code> has subcmds => (
+ is => 'ro',
+ default => sub { [] },
+ );</code></pre>
+
+<p>The default formatting will keep the container broken, giving</p>
+
+<pre><code> # perltidy [default]
+ has subcmds => (
+ is => 'ro',
+ default => sub { [] },
+ );</code></pre>
+
+<p>If old breakpoints are ignored, the list will be flattened:</p>
+
+<pre><code> # perltidy -iob
+ has subcmds => ( is => 'ro', default => sub { [] }, );</code></pre>
+
+<p>Besides flattening lists, this parameter also applies to lines broken at certain logical breakpoints such as 'if' and 'or'.</p>
+
+<p>Even if this is parameter is not used globally, it provides a convenient way to flatten selected lists from within an editor.</p>
+
</dd>
<dt id="kis---keep-interior-semicolons"><b>-kis</b>, <b>--keep-interior-semicolons</b></dt>
<dd>
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents perltidy version 20210717.04</p>
+<p>This man page documents perltidy version 20211029</p>
<h1 id="BUG-REPORTS">BUG REPORTS</h1>
+++ /dev/null
-#!/usr/bin/perl -w
-use strict;
-use warnings;
-
-# This is a script which can try to fix a formatting problem which could have
-# been introduced by perltidy if certain versions of perltidy were run with the
-# particular parameter combination -scbb -csc.
-
-# The problem occurred in versions 20200110, 20200619, and 20200822 when the
-# parameter combination -scbb -csc was used.
-
-# This seems to be a fairly rare combination but could certainly happen. The
-# problem was found during random testing of perltidy. It is fixed in the latest
-# version.
-
-# What happened is that two consecutive lines which had closing braces
-# and side comments generated by the -csc parameter were missing a
-# separating newline. So for example the following two lines:
-
-# } ## end if (...
-# } ## end while (<STYLES>...
-
-# were actually combined like this:
-# } ## end if (...} ## end while (<STYLES>...
-
-# If this happened to your script you could insert the line breaks by hand. An
-# alternative is to run this script on the bad file. It runs as a filter and
-# looks for the special patterns and inserts the missing newlines.
-
-# This will probably work on a script which has just been run once with these
-# parameters. But it will probably not work if the script has been reformatted
-# with these parameters multiple times, or if iterations have been done.
-# Unfortunately in that case key comment information will have been lost.
-
-# The script can be modified if a special side comment prefix other than '##
-# end' was used.
-
-# usage:
-# fix-scbb-csc-bug.pl <infile >ofile
-
-# This is what we are looking for: a closing brace followed by csc prefix
-my $pattern = '} ## end';
-
-while ( my $line = <> ) {
- chomp $line;
-
- if ( $line && $line =~ /$pattern/ ) {
-
- my $leading_spaces = "";
- my $text;
- if ( $line =~ /^(\s*)(.*)$/ ) { $leading_spaces = $1; $text = $2 }
- my @parts = split /$pattern/, $text;
-
- # just print the line for an exact match
- if ( !@parts ) { print $line, "\n"; next }
-
- my $csc = "";
- my $braces = "";
- my @lines;
- while ( @parts > 1 ) {
-
- # Start at the end and work back, saving lines in @lines
- # If we see something with trailing braces, like } ## end }}
- # then we will break before the trailing braces.
- my $part = pop(@parts);
- $csc = $part;
- $braces = "";
-
- # it's easiest to reverse the string, match multiple braces, and
- # reverse again
- my $rev = reverse $part;
- if ( $rev =~ /^([\}\s]+)(.*)$/ ) {
- $csc = reverse $2;
- $braces = reverse $1;
- }
- push @lines, $pattern . $csc;
- push @lines, $braces if ($braces);
- }
-
- # The first section needs leading whitespace
- if (@parts) {
- my $part = pop(@parts);
- if ($part) {
- my $line = $leading_spaces . $part;
- push @lines, $line;
- }
- elsif (@lines) {
- my $i = -1;
- if ($braces) { $i = -2 }
- $lines[$i] = $leading_spaces . $lines[$i];
- }
- }
- while ( my $line = shift @lines ) {
- print $line . "\n";
- }
- next;
- }
- print $line. "\n";
-}
# Release version must be bumped, and it is probably past time for a
# release anyway.
- $VERSION = '20210717.04';
+ $VERSION = '20211029';
}
sub DESTROY {
=head1 VERSION
-This man page documents Perl::Tidy version 20210717.04
+This man page documents Perl::Tidy version 20211029
=head1 LICENSE
package Perl::Tidy::Debugger;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub new {
package Perl::Tidy::DevNull;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub new { my $self = shift; return bless {}, $self }
sub print { return }
sub close { return }
package Perl::Tidy::Diagnostics;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub AUTOLOAD {
package Perl::Tidy::FileWriter;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
use constant DEVEL_MODE => 0;
{ #<<< A non-indenting brace to contain all lexical variables
use Carp;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
# 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 = '20210717.04';
+our $VERSION = '20211029';
use File::Basename;
use strict;
use warnings;
use Carp;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub AUTOLOAD {
use strict;
use warnings;
use Carp;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub AUTOLOAD {
package Perl::Tidy::IndentationItem;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
BEGIN {
package Perl::Tidy::LineBuffer;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub AUTOLOAD {
package Perl::Tidy::LineSink;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub AUTOLOAD {
package Perl::Tidy::LineSource;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub AUTOLOAD {
package Perl::Tidy::Logger;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
sub AUTOLOAD {
package Perl::Tidy::Tokenizer;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
# this can be turned on for extra checking during development
use constant DEVEL_MODE => 0;
use strict;
use warnings;
use Carp;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
use Perl::Tidy::VerticalAligner::Alignment;
use Perl::Tidy::VerticalAligner::Line;
{ #<<< A non-indenting brace
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
# _column_ # the current column number
# _saved_column_ # a place for temporary storage
package Perl::Tidy::VerticalAligner::Line;
use strict;
use warnings;
-our $VERSION = '20210717.04';
+our $VERSION = '20211029';
BEGIN {
my $i = 0;
-# Checklist of some things to when preparing a new version and/or release
+# Checklist for preparing a new version and/or release
+- basic quality control:
+ - 'make test' successful for all commit canditates
+ - run 'devbin/run__convergence_tests.pl' for all commit candidates
+ - Run perlcritic
+ - run NYTProf and check the activity and performance of all changed code
+ - suggested random testing minimum test duration without irregularities:
+ - 3 cpu hours for a commit candidate
+ - 8 cpu hours for a +0.01 version bump candidate
+ - 24 cpu hours for a new release candidate
+ - run 'author tests' on a much larger body of code than is covered by the .t
+ files.
+ - compare results of the current version with previous version
- review tickets at [rt.cpan.org](https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Tidy)
- review the issues at [github](https://github.com/perltidy/perltidy/issues/)
- compare formatting with the new version with previous version on all files in test area
perl -d:NYTProf perltidy.pl -pbp -nst -nse -wn -xci perltidy.pl
nytprofhtml --open
- compare run time with previous version
-- release candidate should show no irregularities in at least 24 cpu hours of random testing
-- run 'devbin/run__convergence_tests.pl' to insure convergence
-- run 'author tests' on a much larger body of code than is covered by the .t
- files.
- - compare results of the current version with previous version
- review tickets at sourceforge (hardly used now, but possible)
- review/update the CHANGES.md file
- be sure RPerl still works:
- use perlbrew to do local checks and debugging on earlier versions of perl if desired
- Run tidyall -a to be sure code is tidied
- note that I have tidyall set to also run perlcritic right now
-- Run perlcritic (if not done by tidyall)
- run podchecker on all .pod files
- run ispell on all .pod files
- Be sure builds at Travis.CI and Appveyor are clean for all version of perl
use strict;
use Getopt::Long;
-# This script will recombine the perltidy binary script and all of its modules
-# into a single, monolithic script. I use it for making a temporary "sandbox"
-# for debugging.
-
-# This is also useful for making a copy of previous versions for parallel
-# debugging sessions.
-
my $usage = <<EOM;
This script will recombine the perltidy binary script and all of its modules