# Perltidy Change Log
-## 2020 10 01.03
+## 2020 12 02
+
+ - This release is being made primarily to make available a several new formatting
+ parameters, in particular -xci, -kbb=s, -kba=s, and -wnxl=s. No significant
+ bugs have been found since the previous release, but numerous minor issues have
+ been found and fixed as listed below.
+
+ - This version is about 20% faster than the previous version due to optimizations
+ made with the help of Devel::NYTProf.
- Added flag -wnxl=s, --weld-nested-exclusion-list=s, to provide control which containers
are welded with the --weld-nested-containers parameter. This is related to issue git #45.
- Merged pull request git #46 which fixes the docs regarding the -fse flag.
- - This release is being made to make available a number of new formatting
- parameters. No significant bugs have been found since the previous release,
- but several minor issues have been found and fixed as listed below.
-
- Fixed issue git #45, -vtc=n flag was ignored when -wn was set.
- implement request RT #133649, delete-old-newlines selectively. Two parameters,
- Added 'state' as a keyword.
- - This version is about 20% faster than the previous version due to optimizations
- made with the help of Devel::NYTProf.
-
- A better test for convergence has been added. When iterations are requested,
the new test will stop after the first pass if no changes in line break
locations are made. Previously, file checksums were used and required at least two
t/snippets20.t
t/snippets21.t
t/snippets22.t
+t/snippets23.t
t/snippets3.t
t/snippets4.t
t/snippets5.t
=head1 VERSION
-This man page documents perltidy version 20201001.03
+This man page documents perltidy version 20201202
=head1 BUG REPORTS
<dl>
+<dt id="removed-excess-spaces-in-a-package-declaration"><b>removed excess spaces in a package declaration</b></dt>
+<dd>
+
+<p>Testing revealed that for a line such as</p>
+
+<pre><code> package Bob::Dog;</code></pre>
+
+<p>which has extra spaces or even tabs after the keyword 'package', the extra spaces or tabs were not being removed. This was fixed 28 Nov 2020, 008443d. The line now formats to</p>
+
+<pre><code> package Bob::Dog;</code></pre>
+
+</dd>
+<dt id="do-not-automatically-delete-closing-side-comments-with---indent-only"><b>do not automatically delete closing side comments with --indent-only</b></dt>
+<dd>
+
+<p>For the parameter combination --indent-only and --closing-side-comments, old closing side comments were getting deleted but new closing side comments were not made. A fix was made to prevent this deletion. This fix was made 27 Nov 2020, 957e0ca.</p>
+
+</dd>
<dt id="fix-to-stop-at-1-iteration-when-using---indent-only"><b>fix to stop at 1 iteration when using --indent-only</b></dt>
<dd>
-<p>Previously, for the combination --indent-only and -conv, two iterations would be done. Only one iteration is necessary in this case.</p>
+<p>Previously, for the combination --indent-only and -conv, two iterations would be done. Only one iteration is necessary in this case. Fix made 23 Nov 2020, ae493d8.</p>
</dd>
<dt id="fix-for-formatting-signed-numbers-with-spaces"><b>fix for formatting signed numbers with spaces</b></dt>
<pre><code> @london = ( deg2rad(-0.5), deg2rad( 90 - 51.3 ) );</code></pre>
-<p>Notice that the space within the parens around the '-0.5' is gone. An update was made to fix this, so that the final state is reached in one step. This fix was made 23 Nov 2020.</p>
+<p>Notice that the space within the parens around the '-0.5' is gone. An update was made to fix this, so that the final state is reached in one step. This fix was made 23 Nov 2020, f477c8b.</p>
</dd>
<dt id="fix-to-prevent-conversion-of-a-block-comment-to-hanging-side-comment"><b>fix to prevent conversion of a block comment to hanging side comment</b></dt>
<p>For the following specific contitions the block comment in line 2 could be converted into a hanging side comment, which is undesirable:</p>
-<pre><code> 1. It contains nothing except for a '#'
+<pre><code> 1. The line contains nothing except for a '#' with no leading space
2. It follows a line with side comment
3. It has indentation level > 0</code></pre>
-<p>An update was made to prevent this from happening. There are two cases, depending on the value of --maximum-consecutive-blank-lines, or -mbl. If this value is positive (the default) then a blank line is inserted above the block comment to prevent it from becoming a hanging side comment. If this -mbl is zero, then the comment is converted to be a static block comment which again prevents it from becoming a hanging side comment. This fix was made 23 Nov 2020.</p>
+<p>An update was made to prevent this from happening. There are two cases, depending on the value of --maximum-consecutive-blank-lines, or -mbl. If this value is positive (the default) then a blank line is inserted above the block comment to prevent it from becoming a hanging side comment. If this -mbl is zero, then the comment is converted to be a static block comment which again prevents it from becoming a hanging side comment. This fix was made 23 Nov 2020, 2eb3de1.</p>
</dd>
<dt id="improved-convergence-test"><b>improved convergence test</b></dt>
elsif ( !$m0 && $m1 ) { $CONFIG[1] = 1; }
else { $ok = 0; last; }</code></pre>
-<p>This update was made 15 Nov 2020.</p>
+<p>This update was made 15 Nov 2020, 2b7784d.</p>
</dd>
<dt id="added-option--wnxl-s-to-give-control-of-welding-by-the--wn-parameter"><b>added option -wnxl=s to give control of welding by the -wn parameter</b></dt>
<h1>Perltidy Change Log</h1>
-<h2>2020 10 01.03</h2>
+<h2>2020 12 02</h2>
-<pre><code>- Added flag -wnxl=s, --weld-nested-exclusion-list=s, to provide control which containers
+<pre><code>- This release is being made primarily to make available a several new formatting
+ parameters, in particular -xci, -kbb=s, -kba=s, and -wnxl=s. No significant
+ bugs have been found since the previous release, but numerous minor issues have
+ been found and fixed as listed below.
+
+- This version is about 20% faster than the previous version due to optimizations
+ made with the help of Devel::NYTProf.
+
+- Added flag -wnxl=s, --weld-nested-exclusion-list=s, to provide control which containers
are welded with the --weld-nested-containers parameter. This is related to issue git #45.
- Merged pull request git #46 which fixes the docs regarding the -fse flag.
-- This release is being made to make available a number of new formatting
- parameters. No significant bugs have been found since the previous release,
- but several minor issues have been found and fixed as listed below.
-
- Fixed issue git #45, -vtc=n flag was ignored when -wn was set.
- implement request RT #133649, delete-old-newlines selectively. Two parameters,
- Added 'state' as a keyword.
-- This version is about 20% faster than the previous version due to optimizations
- made with the help of Devel::NYTProf.
-
- A better test for convergence has been added. When iterations are requested,
the new test will stop after the first pass if no changes in line break
locations are made. Previously, file checksums were used and required at least two
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents Perl::Tidy version 20201001.03</p>
+<p>This man page documents Perl::Tidy version 20201202</p>
<h1 id="LICENSE">LICENSE</h1>
<dt id="conv---converge"><b>-conv</b>, <b>--converge</b></dt>
<dd>
-<p>This flag is equivalent to <b>-it=4</b> and is included to simplify iteration control. For all practical purposes one either does or does not want to be sure that the output is converged, and there is no penalty to using a large iteration limit since perltidy will check for convergence and stop iterating as soon as possible. The default is <b>-nconv</b> (no convergence check). Using <b>-conv</b> will approximately double run time since normally one extra iteration is required to verify convergence.</p>
+<p>This flag is equivalent to <b>-it=4</b> and is included to simplify iteration control. For all practical purposes one either does or does not want to be sure that the output is converged, and there is no penalty to using a large iteration limit since perltidy will check for convergence and stop iterating as soon as possible. The default is <b>-nconv</b> (no convergence check). Using <b>-conv</b> will approximately double run time since typically one extra iteration is required to verify convergence. No extra iterations are required if no new line breaks are made, and two extra iterations are occasionally needed when reformatting complex code structures, such as deeply nested ternary statements.</p>
</dd>
</dl>
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents perltidy version 20201001.03</p>
+<p>This man page documents perltidy version 20201202</p>
<h1 id="BUG-REPORTS">BUG REPORTS</h1>
# Release version must be bumped, and it is probably past time for a
# release anyway.
- $VERSION = '20201001.03';
+ $VERSION = '20201202';
}
sub DESTROY {
elsif ($do_convergence_test) {
# stop if the formatter has converged
- $stop_now ||= defined($iteration_of_formatter_convergence);
+ $stop_now ||= defined($iteration_of_formatter_convergence);
my $digest = $md5_hex->($sink_buffer);
if ( !defined( $saw_md5{$digest} ) ) {
# end states. This has happened in the past
# but at present there are no known instances.
$convergence_log_message = <<EOM;
-Blinking. Output for iteration $iter same as for $saw_md5{$digest}.
+BLINKER. Output for iteration $iter same as for $saw_md5{$digest}.
EOM
+ $stopping_on_error ||= $convergence_log_message;
+ if (DEVEL_MODE) {
+ print STDERR $convergence_log_message;
+ }
$diagnostics_object->write_diagnostics(
$convergence_log_message)
if $diagnostics_object;
if ($stop_now) {
- if (DEVEL_MODE) { #<<<
- if ( defined($iteration_of_formatter_convergence) ) {
- if ( $iteration_of_formatter_convergence < $iter - 1 ) {
- print STDERR
+ if (DEVEL_MODE) {
+
+ if ( defined($iteration_of_formatter_convergence) ) {
+
+ # This message cannot appear unless the formatter
+ # convergence test above is temporarily skipped for
+ # testing.
+ if ( $iteration_of_formatter_convergence <
+ $iter - 1 )
+ {
+ print STDERR
"STRANGE Early conv in $display_name: Stopping on it=$iter, converged in formatter on $iteration_of_formatter_convergence\n";
+ }
}
- }
- elsif ( !$stopping_on_error ) {
- print STDERR
+ elsif ( !$stopping_on_error ) {
+ print STDERR
"STRANGE no conv in $display_name: stopping on it=$iter, but not converged in formatter\n";
- }
+ }
}
# we are stopping the iterations early;
=head1 VERSION
-This man page documents Perl::Tidy version 20201001.03
+This man page documents Perl::Tidy version 20201202
=head1 LICENSE
package Perl::Tidy::Debugger;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub new {
package Perl::Tidy::DevNull;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub new { my $self = shift; return bless {}, $self }
sub print { return }
sub close { return }
package Perl::Tidy::Diagnostics;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub AUTOLOAD {
package Perl::Tidy::FileWriter;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
use constant DEVEL_MODE => 0;
{ #<<< A non-indenting brace to contain all lexical variables
use Carp;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
# 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 = '20201001.03';
+our $VERSION = '20201202';
use File::Basename;
use strict;
use warnings;
use Carp;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub AUTOLOAD {
use strict;
use warnings;
use Carp;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub AUTOLOAD {
package Perl::Tidy::IndentationItem;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
BEGIN {
package Perl::Tidy::LineBuffer;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub AUTOLOAD {
package Perl::Tidy::LineSink;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub AUTOLOAD {
package Perl::Tidy::LineSource;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub AUTOLOAD {
package Perl::Tidy::Logger;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
sub AUTOLOAD {
package Perl::Tidy::Tokenizer;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
use Perl::Tidy::LineBuffer;
use Carp;
# If it does not find one of these, or this is a restart, it calls the
# original scanner directly.
- # This gives the same results as the full scanner in about 1/4 the
- # total runtime for a typical input stream.
+ # This gives the same results as the full scanner in about 1/4 the
+ # total runtime for a typical input stream.
my $i_begin = $i;
my $tok_begin = $tok;
package Perl::Tidy::VerticalAligner;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
use Perl::Tidy::VerticalAligner::Alignment;
use Perl::Tidy::VerticalAligner::Line;
{ #<<< A non-indenting brace
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
# _column_ # the current column number
# _saved_column_ # a place for temporary storage
package Perl::Tidy::VerticalAligner::Line;
use strict;
use warnings;
-our $VERSION = '20201001.03';
+our $VERSION = '20201202';
BEGIN {
my $i = 0;
package Bob::Dog;
which has extra spaces or even tabs after the keyword 'package', the
-extra spaces or tabs were not being removed. This was fixed 28 Nov 2020.
+extra spaces or tabs were not being removed. This was fixed 28 Nov 2020, 008443d.
The line now formats to
package Bob::Dog;
For the parameter combination --indent-only and --closing-side-comments, old
closing side comments were getting deleted but new closing side comments were
-not made. A fix was made to prevent this deletion. This fix was made 27 Nov 2020.
+not made. A fix was made to prevent this deletion. This fix was made 27 Nov 2020, 957e0ca.
=item B<fix to stop at 1 iteration when using --indent-only>
Previously, for the combination --indent-only and -conv, two iterations
-would be done. Only one iteration is necessary in this case.
+would be done. Only one iteration is necessary in this case. Fix made 23 Nov 2020, ae493d8.
=item B<fix for formatting signed numbers with spaces>
Notice that the space within the parens around the '-0.5' is gone. An update
was made to fix this, so that the final state is reached in one step. This fix
-was made 23 Nov 2020.
+was made 23 Nov 2020, f477c8b.
=item B<fix to prevent conversion of a block comment to hanging side comment>
For the following specific contitions the block comment in line 2 could be
converted into a hanging side comment, which is undesirable:
- 1. It contains nothing except for a '#'
+ 1. The line contains nothing except for a '#' with no leading space
2. It follows a line with side comment
3. It has indentation level > 0
comment to prevent it from becoming a hanging side comment. If this -mbl is
zero, then the comment is converted to be a static block comment which again
prevents it from becoming a hanging side comment. This fix was made 23 Nov
-2020.
+2020, 2eb3de1.
=item B<improved convergence test>
elsif ( !$m0 && $m1 ) { $CONFIG[1] = 1; }
else { $ok = 0; last; }
-This update was made 15 Nov 2020.
+This update was made 15 Nov 2020, 2b7784d.
=item B<added option -wnxl=s to give control of welding by the -wn parameter>
--- /dev/null
+#!/usr/bin/perl -w
+use strict;
+my @files = @ARGV;
+my %saw;
+# Look at a number of .pro profiles and show ther common flags.
+# This can help pinpoint the flags which are causing an issue.
+foreach my $file (@files) {
+ open( IN, "<", $file ) || die "cannot open $file: $!\n";
+ while ( my $line = <IN> ) {
+ chomp $line;
+ $line =~ s/^\s+//;
+ $line =~ s/\s+$//;
+ next if ( $line =~ /#/ );
+ $saw{$line}++;
+ }
+ close IN;
+}
+my $nfiles=@files;
+foreach my $key(sort keys %saw) {
+ next if ($saw{$key} != $nfiles);
+ print $key,"\n";
+}
# Set input file for next run
$ifile = $ifile_original;
- if ( $case < 4 ) {
- $ifile = $ofile;
- }
- elsif ( $chain_mode && !$err ) {
+ if ( $case >= 4 && $chain_mode && !$err ) {
# 'Chaining' means the next run formats the output of the previous
# run instead of formatting the original file.
# 0 = no chaining
# Case 2 creates the smallest possible output file size
if ( $case == 2 ) {
- $rrandom_parameters = ["--mangle -dsc -dac -i=0 -ci=0 -it=2"];
+ $rrandom_parameters = ["-dsm -dac -i=0 -ci=0 -it=2 -mbl=0"];
}
# Case 3 checks extrude from mangle (case 2)