From: Steve Hancock
Date: Fri, 16 Nov 2018 16:50:12 +0000 (-0800)
Subject: new version #, minor alignment updates
X-Git-Tag: 20181117~5
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=dfadedfe99155e36d5fcd51ca7c6476fe27c8a45;p=perltidy.git
new version #, minor alignment updates
---
diff --git a/CHANGES.md b/CHANGES.md
index 0a63fa20..e13c27e9 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,20 +1,14 @@
# Perltidy Change Log
-## 2018 11 16
-
- - The packaging for this version has changed. The Tidy.pm file has
- been split into a smaller Tidy.pm file plus supporting modules in the path
- Perl/Tidy/*.
-
- - A number of new installation test cases have been added.
+## 2018 11 17
- Fixed RT #126965, in which a ternary operator was misparsed if immediately
following a function call without arguments, such as:
my $restrict_customer = shift ? 1 : 0;
- Fixed RT #125012: bug in -mangle --delete-all-comments
- A needed blank space bareword tokens was being removed when comments were
- deleted
+ A needed blank space before bareword tokens was being removed when comments
+ were deleted
- Fixed RT #81852: Stacked containers and quoting operators. Quoted words
(qw) delimited by container tokens ('{', '[', '(', '<') are now included in
@@ -39,8 +33,6 @@
- Fixed RT #124594, license text desc. changed from 'GPL-2.0+' to 'gpl_2'
- - RT #106493; source code repository is https://github.com/perltidy/perltidy
-
- Fixed bug in which a warning about a possible code bug was issued in a
script with brace errors.
@@ -56,19 +48,9 @@
- Fixed RT #127633, undesirable line break after return when -baao flag is set
- - Vertical alignment has been improved in several ways. Thanks especially to
- Glenn for sending helpful snippets.
-
- - In many cases, two lines which were previously left unaligned are now
- aligned.
-
- OLD:
- $expect = "1$expect" if $expect =~ /^e/i;
- $p = "1$p" if defined $p and $p =~ /^e/i;
-
- NEW:
- $expect = "1$expect" if $expect =~ /^e/i;
- $p = "1$p" if defined $p and $p =~ /^e/i;
+ - Fixed RT #127035, vertical alignment. Vertical alignment has been improved
+ in several ways. Thanks especially to Michael Wardman and Glenn for sending
+ helpful snippets.
- Alignment of the =~ operators has been reactivated.
@@ -92,6 +74,29 @@
is( pop() // 7, 0, 'pop() // ... works' );
is( pop @ARGV // 7, 3, 'pop @array // ... works' );
+ - The rules for alignment of just two lines have been adjusted,
+ hopefully to be a little better overall. In some cases, two
+ lines which were previously unaligned are now aligned, and vice-versa.
+
+ OLD:
+ $expect = "1$expect" if $expect =~ /^e/i;
+ $p = "1$p" if defined $p and $p =~ /^e/i;
+
+ NEW:
+ $expect = "1$expect" if $expect =~ /^e/i;
+ $p = "1$p" if defined $p and $p =~ /^e/i;
+
+
+ - RT #106493; source code repository location has been added to docs; it is
+ https://github.com/perltidy/perltidy
+
+ - The packaging for this version has changed. The Tidy.pm module is much
+ smaller. Supporting modules have been split out from it and placed below
+ it in the path Perl/Tidy/*.
+
+ - A number of new installation test cases have been added. Updates are now
+ continuously tested at Travis CI against versions back to Perl 5.08.
+
## 2018 02 20
- RT #124469, #124494, perltidy often making empty files. The previous had
diff --git a/MANIFEST b/MANIFEST
index 14ddbccf..18acd6ef 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,8 +1,16 @@
-_config.yml
bin/perltidy
BUGS.md
CHANGES.md
COPYING
+docs/ChangeLog.html
+docs/COPYING.txt
+docs/index.html
+docs/index.md
+docs/INSTALL.html
+docs/perltidy.html
+docs/stylekey.html
+docs/Tidy.html
+docs/tutorial.html
examples/bbtidy.pl
examples/break_long_quotes.pl
examples/ex_mp.pl
diff --git a/README.md b/README.md
index fe007b2b..3028be44 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Welcome to Perltidy
+# Welcome to Perltidy!
Perltidy is a tool to indent and reformat perl scripts. It can also
write scripts in html format.
@@ -6,7 +6,52 @@ write scripts in html format.
Perltidy is free software released under the GNU General Public
License -- please see the included file "COPYING" for details.
-Documentation can be found at the web site [at GitHub](https://perltidy.github.io/perltidy/)
-or [at Sourceforge](perltidy.sourceforge.net)
+# PREREQUISITES
-A copy of the web site in contained in the docs folder of the distribution.
+`perltidy` should work with most standard Perl installations.
+The following modules are not required, but perltidy may use them if
+detected:
+
+ HTML::Entities will be used to encode HTML entities if detected
+ Pod::Html will be used to format pod text
+
+The total disk space needed after removing the installation directory will
+about 2 Mb.
+
+# DOWNLOAD
+
+There are two source distribution files:
+
+- A `.tgz` "tarball", with Unix-style <lf> line endings, and
+- A zip file, `.zip`, with Windows-style <cr><lf> line endings.
+
+In addition, the web site has links to debian and RPM packages.
+
+# INSTALLATION
+
+For most standard installations, the standard Makefile.PL method should work:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+The INSTALL file has additional installation notes, and tells how
+to use perltidy without doing an installation.
+
+# WHAT NEXT
+
+Please see the CHANGES file for notices of any recent updates.
+
+Please see the BUGS file for a list of all known open bugs.
+
+Documentation can be found in the `docs` directory, and it can also be
+found at http://perltidy.sourceforge.net
+
+Reading the brief tutorial should help you use perltidy effectively.
+
+# FEEDBACK / BUG REPORTS
+
+A list of current bugs and issues can be found at the CPAN site [https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Tidy](https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Tidy)
+
+To report a new bug or problem, use the link on this page .
diff --git a/bin/perltidy b/bin/perltidy
index e7cb7e39..b562145d 100755
--- a/bin/perltidy
+++ b/bin/perltidy
@@ -3461,7 +3461,7 @@ perlstyle(1), Perl::Tidy(3)
=head1 VERSION
-This man page documents perltidy version 20181116
+This man page documents perltidy version 20181117
=head1 BUG REPORTS
diff --git a/dev-bin/build.pl b/dev-bin/build.pl
index 69e8b0d1..440c8cbd 100755
--- a/dev-bin/build.pl
+++ b/dev-bin/build.pl
@@ -43,7 +43,7 @@ my $fh_log;
# These are the main steps, in approximate order, for making a new version
# Note: Since perl critic is in the .tidyallrc, a separate 'PC' step is not
# needed
-my $rsteps = [qw( CHK V PC TIDY T CL POD DIST)];
+my $rsteps = [qw( CHK V PC TIDY T CL DOCS DIST)];
my $rstatus = {};
foreach my $step ( @{$rsteps} ) { $rstatus->{$step} = 'TBD' }
@@ -59,11 +59,12 @@ my $rcode = {
'PC' => \&run_perl_critic,
'TIDY' => \&run_tidyall,
'T' => \&make_tests,
- 'POD' => \&make_docs,
+ 'DOCS' => \&make_docs,
'DIST' => \&make_dist,
'CL' => sub {openurl($changelog)},
'LOG' => sub { openurl($logfile) },
'DIR' => sub { openurl("local-docs") },
+ 'HTML' => sub { openurl("docs/index.html") },
};
open( $fh_log, ">", $logfile ) or die "cannot open log file $logfile: $!\n";
@@ -84,10 +85,11 @@ tidy - run tidyall (tidy & critic) status: $rstatus->{'TIDY'}
pc - run PerlCritic (critic only) status: $rstatus->{'PC'}
t - make Tests status: $rstatus->{'T'}
cl - review/edit ChangeLog.pod status: $rstatus->{'CL'}
-pod - check and process POD docs status: $rstatus->{'POD'}
+docs - check and process POD & html status: $rstatus->{'DOCS'}
dist - make a Distribution tar.gz status: $rstatus->{'DIST'}
dir - browse doc files
log - view Log file
+html - view html files
q,x - eXit
@@ -225,14 +227,19 @@ sub make_docs {
local $" = ') (';
print "These file(s) had errors: (@errors)\n";
hitcr("See the log file");
- $rstatus->{'POD'} = 'TBD';
+ $rstatus->{'DOCS'} = 'TBD';
return;
}
# finish up
my $result = sys_command("(cd local-docs; make)");
print $result;
- $rstatus->{'POD'} = $result =~ /Stop\./i ? 'TBD' : 'OK';
+ my $status = $result =~ /Stop\./i ? 'TBD' : 'OK';
+ if ($status eq 'OK') {
+ $result = sys_command("(cd bubba; make)");
+ print $result;
+ }
+ $rstatus->{'DOCS'} = $status;
hitcr();
return;
}
diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html
index d11f144e..cbeb3ea5 100644
--- a/docs/ChangeLog.html
+++ b/docs/ChangeLog.html
@@ -14,7 +14,7 @@
- Perltidy Change Log
- The packaging for this version has changed. The Tidy.pm file has
- been split into a smaller Tidy.pm file plus supporting modules in the path
- Perl/Tidy/*.
-
- - Fixed RT #126965, in which a ternary operator was misparsed if immediately
+ - Fixed RT #126965, in which a ternary operator was misparsed if immediately
following a function call without arguments, such as:
my $restrict_customer = shift ? 1 : 0;
- Fixed RT #125012: bug in -mangle --delete-all-comments
- A needed blank space bareword tokens was being removed when comments were
- deleted
+ A needed blank space before bareword tokens was being removed when comments
+ were deleted
- Fixed RT #81852: Stacked containers and quoting operators. Quoted words
(qw) delimited by container tokens ('{', '[', '(', '<') are now included in
@@ -110,10 +106,6 @@
- Fixed RT #124594, license text desc. changed from 'GPL-2.0+' to 'gpl_2'
- - RT #106493; source code repository is https://github.com/perltidy/perltidy
-
- - Numerous installation test snippets have been added.
-
- Fixed bug in which a warning about a possible code bug was issued in a
script with brace errors.
@@ -127,19 +119,11 @@
some lines was was not entabbed. This happened in code which was adjusted
for vertical alignment and in hanging side comments. Thanks to Glenn.
- - Vertical alignment has been improved in several ways. Thanks especially to
- Glenn for sending helpful snippets.
+ - Fixed RT #127633, undesirable line break after return when -baao flag is set
- - In many cases, two lines which were previously left unaligned are now
- aligned.
-
- OLD:
- $expect = "1$expect" if $expect =~ /^e/i;
- $p = "1$p" if defined $p and $p =~ /^e/i;
-
- NEW:
- $expect = "1$expect" if $expect =~ /^e/i;
- $p = "1$p" if defined $p and $p =~ /^e/i;
+ - Fixed RT #127035, vertical alignment. Vertical alignment has been improved
+ in several ways. Thanks especially to Michael Wardman and Glenn for sending
+ helpful snippets.
- Alignment of the =~ operators has been reactivated.
@@ -161,7 +145,30 @@
NEW:
is( pop // 7, 7, 'pop // ... works' );
is( pop() // 7, 0, 'pop() // ... works' );
- is( pop @ARGV // 7, 3, 'pop @array // ... works' );
+ is( pop @ARGV // 7, 3, 'pop @array // ... works' );
+
+ - The rules for alignment of just two lines have been adjusted,
+ hopefully to be a little better overall. In some cases, two
+ lines which were previously unaligned are now aligned, and vice-versa.
+
+ OLD:
+ $expect = "1$expect" if $expect =~ /^e/i;
+ $p = "1$p" if defined $p and $p =~ /^e/i;
+
+ NEW:
+ $expect = "1$expect" if $expect =~ /^e/i;
+ $p = "1$p" if defined $p and $p =~ /^e/i;
+
+
+ - RT #106493; source code repository location has been added to docs; it is
+ https://github.com/perltidy/perltidy
+
+ - The packaging for this version has changed. The Tidy.pm module is much
+ smaller. Supporting modules have been split out from it and placed below
+ it in the path Perl/Tidy/*.
+
+ - A number of new installation test cases have been added. Updates are now
+ continuously tested at Travis CI against versions back to Perl 5.08.
2018 02 20
diff --git a/docs/Tidy.html b/docs/Tidy.html
index e7daa5dd..478b6ed6 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -349,7 +349,7 @@
VERSION
-This man page documents Perl::Tidy version 20180220.01
+This man page documents Perl::Tidy version 20181117
LICENSE
diff --git a/docs/index.html b/docs/index.html
index 9bfa202f..a71ef597 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -43,7 +43,7 @@ about 2 Mb.
Installation
-Perl::Tidy can be installed directly from CPAN one of the available methods.
+Perl::Tidy can be installed directly from CPAN one of the standard methods.
One way is to download a distribution file, unpack it and then
test and install using the Makefile.PL:
@@ -54,13 +54,14 @@ make test
make install
-The INSTALL file has additional installation notes, and tells how
-to use perltidy without doing an installation.
+The INSTALL file has additional installation notes. They
+are mainly for older sytems but also tell how to use perltidy without doing an installation.
Links
diff --git a/docs/index.md b/docs/index.md
index 16524524..bc3e054b 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -49,7 +49,7 @@ about 2 Mb.
## Installation
-Perl::Tidy can be installed directly from CPAN one of the available methods.
+Perl::Tidy can be installed directly from CPAN one of the standard methods.
One way is to download a distribution file, unpack it and then
test and install using the Makefile.PL:
@@ -59,13 +59,13 @@ test and install using the Makefile.PL:
make test
make install
-The [INSTALL file](./INSTALL.html) has additional installation notes, and tells how
-to use perltidy without doing an installation.
-
+The [INSTALL file](./INSTALL.html) has additional installation notes. They
+are mainly for older sytems but also tell how to use perltidy without doing an installation.
## Links
- [Perl::Tidy source code repository at GitHub](https://github.com/perltidy/perltidy)
+ - [tidyall](https://metacpan.org/pod/distribution/Code-TidyAll/bin/tidyall) is a great tool for automatically running perltidy and other tools including perlcritic on a set of project files.
- [Tidyview](http://sourceforge.net/projects/tidyview) is a graphical program for tweaking your .perltidyrc configuration parameters.
- [A perltidy plugin for Sublime Text 2/3](https://github.com/vifo/SublimePerlTidy)
diff --git a/docs/perltidy.html b/docs/perltidy.html
index 4e9039a1..ca979b37 100644
--- a/docs/perltidy.html
+++ b/docs/perltidy.html
@@ -2687,7 +2687,7 @@
VERSION
-This man page documents perltidy version 20180220.01
+This man page documents perltidy version 20181117
BUG REPORTS
diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm
index eb4cd3d9..6993cf4e 100644
--- a/lib/Perl/Tidy.pm
+++ b/lib/Perl/Tidy.pm
@@ -109,7 +109,7 @@ BEGIN {
# Release version must be bumped, and it is probably past time for a
# release anyway.
- $VERSION = '20181116';
+ $VERSION = '20181117';
}
sub streamhandle {
@@ -358,7 +358,7 @@ EOM
}
my $get_hash_ref = sub {
- my ($key) = @_;
+ my ($key) = @_;
my $hash_ref = $input_hash{$key};
if ( defined($hash_ref) ) {
unless ( ref($hash_ref) eq 'HASH' ) {
@@ -1582,7 +1582,7 @@ sub generate_options {
$option_category{$opt} = $category_name[$category];
}
- $category = 11; # HTML
+ $category = 11; # HTML
$option_category{html} = $category_name[$category];
# routine to install and check options
diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod
index b71cef37..4929185e 100644
--- a/lib/Perl/Tidy.pod
+++ b/lib/Perl/Tidy.pod
@@ -410,7 +410,7 @@ C in Tidy.pm.
=head1 VERSION
-This man page documents Perl::Tidy version 20181116
+This man page documents Perl::Tidy version 20181117
=head1 LICENSE
diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm
index fbbfa196..e8ea6b4a 100644
--- a/lib/Perl/Tidy/Formatter.pm
+++ b/lib/Perl/Tidy/Formatter.pm
@@ -9517,6 +9517,19 @@ sub send_lines_to_vertical_aligner {
}
}
+ # Convert a bareword within braces into a quote for matching. This will
+ # allow alignment of expressions like this:
+ # local ( $SIG{'INT'} ) = IGNORE;
+ # local ( $SIG{ALRM} ) = 'POSTMAN';
+ if ( $type eq 'w'
+ && $i > $ibeg
+ && $i < $iend
+ && $types_to_go[ $i - 1 ] eq 'L'
+ && $types_to_go[ $i + 1 ] eq 'R' )
+ {
+ $type = 'Q';
+ }
+
# patch to make numbers and quotes align
if ( $type eq 'n' ) { $type = 'Q' }
diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm
index 4b04e8c5..14c76c0b 100644
--- a/lib/Perl/Tidy/Tokenizer.pm
+++ b/lib/Perl/Tidy/Tokenizer.pm
@@ -1496,11 +1496,11 @@ sub prepare_for_a_new_file {
# ------------------------------------------------------------
my %is_for_foreach;
- @_ = qw(for foreach);
+ @_ = qw(for foreach);
@is_for_foreach{@_} = (1) x scalar(@_);
my %is_my_our;
- @_ = qw(my our);
+ @_ = qw(my our);
@is_my_our{@_} = (1) x scalar(@_);
# These keywords may introduce blocks after parenthesized expressions,
@@ -2409,7 +2409,7 @@ sub prepare_for_a_new_file {
@is_zero_continuation_block_type{@_} = (1) x scalar(@_);
my %is_not_zero_continuation_block_type;
- @_ = qw(sort grep map do eval);
+ @_ = qw(sort grep map do eval);
@is_not_zero_continuation_block_type{@_} = (1) x scalar(@_);
my %is_logical_container;
@@ -2417,33 +2417,33 @@ sub prepare_for_a_new_file {
@is_logical_container{@_} = (1) x scalar(@_);
my %is_binary_type;
- @_ = qw(|| &&);
+ @_ = qw(|| &&);
@is_binary_type{@_} = (1) x scalar(@_);
my %is_binary_keyword;
- @_ = qw(and or err eq ne cmp);
+ @_ = qw(and or err eq ne cmp);
@is_binary_keyword{@_} = (1) x scalar(@_);
# 'L' is token for opening { at hash key
my %is_opening_type;
- @_ = qw< L { ( [ >;
+ @_ = qw< L { ( [ >;
@is_opening_type{@_} = (1) x scalar(@_);
# 'R' is token for closing } at hash key
my %is_closing_type;
- @_ = qw< R } ) ] >;
+ @_ = qw< R } ) ] >;
@is_closing_type{@_} = (1) x scalar(@_);
my %is_redo_last_next_goto;
- @_ = qw(redo last next goto);
+ @_ = qw(redo last next goto);
@is_redo_last_next_goto{@_} = (1) x scalar(@_);
my %is_use_require;
- @_ = qw(use require);
+ @_ = qw(use require);
@is_use_require{@_} = (1) x scalar(@_);
my %is_sub_package;
- @_ = qw(sub package);
+ @_ = qw(sub package);
@is_sub_package{@_} = (1) x scalar(@_);
# This hash holds the hash key in $tokenizer_self for these keywords:
@@ -2585,7 +2585,7 @@ sub prepare_for_a_new_file {
#
# -----------------------------------------------------------------------
- my $line_of_tokens = shift;
+ my $line_of_tokens = shift;
my ($untrimmed_input_line) = $line_of_tokens->{_line_text};
# patch while coding change is underway
@@ -4842,14 +4842,14 @@ sub increase_nesting_depth {
if ( $nested_ternary_flag[ $current_depth[$aa] - 1 ] == 0 ) {
my $pdepth = $total_depth[$aa][ $current_depth[$aa] - 1 ];
if ( $pdepth == $total_depth - 1 ) {
- $indent = 1;
+ $indent = 1;
$nested_ternary_flag[ $current_depth[$aa] - 1 ] = -1;
}
}
}
}
$nested_statement_type[$aa][ $current_depth[$aa] ] = $statement_type;
- $statement_type = "";
+ $statement_type = "";
return ( $seqno, $indent );
}
@@ -7415,11 +7415,11 @@ BEGIN {
# these functions have prototypes of the form (&), so when they are
# followed by a block, that block MAY BE followed by an operator.
# Smartmatch operator ~~ may be followed by anonymous hash or array ref
- @q = qw( do eval );
+ @q = qw( do eval );
@is_block_operator{@q} = (1) x scalar(@q);
# these functions allow an identifier in the indirect object slot
- @q = qw( print printf sort exec system say);
+ @q = qw( print printf sort exec system say);
@is_indirect_object_taker{@q} = (1) x scalar(@q);
# These tokens may precede a code block
@@ -7755,7 +7755,7 @@ BEGIN {
delete $really_want_term{'Y'}; # indirect object, too risky to check syntax;
# let perl do it
- @q = qw(q qq qw qx qr s y tr m);
+ @q = qw(q qq qw qx qr s y tr m);
@is_q_qq_qw_qx_qr_s_y_tr_m{@q} = (1) x scalar(@q);
# These keywords are handled specially in the tokenizer code:
diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm
index 26d65982..f917b0dd 100644
--- a/lib/Perl/Tidy/VerticalAligner.pm
+++ b/lib/Perl/Tidy/VerticalAligner.pm
@@ -1310,6 +1310,7 @@ sub fix_terminal_else {
my $maximum_field_index = $old_line->get_jmax();
# flush if this line has too many fields
+ # variable $GoToLoc indicates goto branch point, for debugging
my $GoToLoc = 1;
if ( $jmax > $maximum_field_index ) { goto NO_MATCH }
@@ -1594,6 +1595,7 @@ sub fix_terminal_else {
NO_MATCH:
+ # variable $GoToLoc is for debugging
#print "no match from $GoToLoc\n";
##print "no match jmax=$jmax max=$maximum_field_index $group_list_type lines=$maximum_line_index token=$old_rtokens->[0]\n";
@@ -2058,22 +2060,27 @@ sub decide_if_aligned {
my $group_list_type = $group_lines[0]->get_list_type();
- # See if these two lines have leading equals type tokens which can be
- # aligned without creating a big gap. These two below are an example that
- # have a large gap and will not be aligned:
- # local (@pieces) = split( /\./, $filename, 2 );
- # local ($just_dir_and_base) = $pieces[0];
- my $good_leading_equals;
- my $rtokens = $group_lines[0]->get_rtokens();
- if ( $rtokens->[0] =~ /=/ ) {
- my $rfields0 = $group_lines[0]->get_rfields();
- my $rfields1 = $group_lines[1]->get_rfields();
- my $len0 = length( $rfields0->[0] );
- my $len1 = length( $rfields1->[0] );
- my $gap = abs( $len0 - $len1 );
-
- # put a limit on the maximum gap we will allow here
- $good_leading_equals = ( $gap > 8 ) ? 0 : 1;
+ my $rtokens = $group_lines[0]->get_rtokens();
+ my $leading_equals = ( $rtokens->[0] =~ /=/ );
+
+ # A marginal match is a match which has different patterns. Normally, we
+ # should not allow exactly two lines to match if marginal. But we will modify
+ # this rule for two lines with a leading equals-like operator such that we
+ # match if the patterns to the left of the equals are the same. So for
+ # example the following two lines are a marginal match but have the same
+ # left side patterns, so we will align the equals.
+ # my $orig = my $format = "^<<<<< ~~\n";
+ # my $abc = "abc";
+ # But these have a different left pattern so they will not be aligned
+ # $xmldoc .= $`;
+ # $self->{'leftovers'} .= "get_rpatterns();
+ my $rpatterns1 = $group_lines[1]->get_rpatterns();
+ my $pat0 = $rpatterns0->[0];
+ my $pat1 = $rpatterns1->[0];
+ $is_marginal = $pat0 ne $pat1;
}
my $do_not_align = (
@@ -2083,15 +2090,16 @@ sub decide_if_aligned {
&& (
- # don't align if it was marked as a 'marginal" match.
- $marginal_match
+ # don't align if it was just a marginal match
+ $is_marginal ##$marginal_match
+ # don't align two lines with big gap
+ # NOTE: I am not sure if this test is actually functional any longer
|| $group_maximum_gap > 12
- # don't align lines with differing number of alignment tokens,
- # unless the first common alignment is an equals
- || ( ( $previous_maximum_jmax_seen != $previous_minimum_jmax_seen )
- && !$good_leading_equals )
+ # or lines with differing number of alignment tokens
+ || ( $previous_maximum_jmax_seen != $previous_minimum_jmax_seen
+ && !$leading_equals )
)
);
diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm
index 194694e1..14e796c2 100644
--- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm
+++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm
@@ -43,7 +43,7 @@ use warnings;
sub new {
my ( $caller, %arg ) = @_;
my $caller_is_obj = ref($caller);
- my $class = $caller_is_obj || $caller;
+ my $class = $caller_is_obj || $caller;
##no strict "refs";
my $self = bless {}, $class;
diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm
index 7cd7cc7e..30669a22 100644
--- a/lib/Perl/Tidy/VerticalAligner/Line.pm
+++ b/lib/Perl/Tidy/VerticalAligner/Line.pm
@@ -41,7 +41,7 @@ use warnings;
sub new {
my ( $caller, %arg ) = @_;
my $caller_is_obj = ref($caller);
- my $class = $caller_is_obj || $caller;
+ my $class = $caller_is_obj || $caller;
##no strict "refs";
my $self = bless {}, $class;
diff --git a/local-docs/ChangeLog.pod b/local-docs/ChangeLog.pod
index 636bdc16..8733a216 100644
--- a/local-docs/ChangeLog.pod
+++ b/local-docs/ChangeLog.pod
@@ -1,6 +1,6 @@
=head1 Perltidy Change Log
-=head2 2018 11 16
+=head2 2018 11 17
- Fixed RT #126965, in which a ternary operator was misparsed if immediately
@@ -8,8 +8,8 @@
my $restrict_customer = shift ? 1 : 0;
- Fixed RT #125012: bug in -mangle --delete-all-comments
- A needed blank space bareword tokens was being removed when comments were
- deleted
+ A needed blank space before bareword tokens was being removed when comments
+ were deleted
- Fixed RT #81852: Stacked containers and quoting operators. Quoted words
(qw) delimited by container tokens ('{', '[', '(', '<') are now included in
@@ -50,20 +50,9 @@
- Fixed RT #127633, undesirable line break after return when -baao flag is set
- Fixed RT #127035, vertical alignment. Vertical alignment has been improved
- in several ways. Thanks especially to Glenn and Michael Wardman for sending
+ in several ways. Thanks especially to Michael Wardman and Glenn for sending
helpful snippets.
- - In many cases, two lines which were previously left unaligned are now
- aligned.
-
- OLD:
- $expect = "1$expect" if $expect =~ /^e/i;
- $p = "1$p" if defined $p and $p =~ /^e/i;
-
- NEW:
- $expect = "1$expect" if $expect =~ /^e/i;
- $p = "1$p" if defined $p and $p =~ /^e/i;
-
- Alignment of the =~ operators has been reactivated.
OLD:
@@ -86,6 +75,19 @@
is( pop() // 7, 0, 'pop() // ... works' );
is( pop @ARGV // 7, 3, 'pop @array // ... works' );
+ - The rules for alignment of just two lines have been adjusted,
+ hopefully to be a little better overall. In some cases, two
+ lines which were previously unaligned are now aligned, and vice-versa.
+
+ OLD:
+ $expect = "1$expect" if $expect =~ /^e/i;
+ $p = "1$p" if defined $p and $p =~ /^e/i;
+
+ NEW:
+ $expect = "1$expect" if $expect =~ /^e/i;
+ $p = "1$p" if defined $p and $p =~ /^e/i;
+
+
- RT #106493; source code repository location has been added to docs; it is
https://github.com/perltidy/perltidy
diff --git a/local-docs/perltidy.md b/local-docs/perltidy.md
index 26b61849..edb1eb4c 100644
--- a/local-docs/perltidy.md
+++ b/local-docs/perltidy.md
@@ -3274,7 +3274,7 @@ perlstyle(1), Perl::Tidy(3)
# VERSION
-This man page documents perltidy version 20181116
+This man page documents perltidy version 20181117
# BUG REPORTS
diff --git a/t/snippets/README.md b/t/snippets/README.md
index b6b75710..41d473ed 100644
--- a/t/snippets/README.md
+++ b/t/snippets/README.md
@@ -136,6 +136,19 @@ corresponding to running with default parameters and the second with '-xyzzy' pa
- Go up to the git root directory and run 'make test' to verify that all
snippets are still working correctly
+
+## What to do if a test script fails
+
+If one of the test scripts fails it could be due to a bug which has been introduced
+or it could be a desirable formatting change introduced by a recent update. In either
+case just run 'make' and look at the differences. The script will give the
+names of the cases with differences. For example, if case 'align6.def' failed
+then the old expected result is 'expect/align6.def' and the new result is 'tmp/align6.def'.
+These files are the result of running perltidy on 'align6.def' with default parameters
+('def.par'). After investigating and fixing any problems with the code,
+run 'make' again, and if all is well run the script it writes 'RUNME.sh'
+to create new snippets if necessary.
+
## How to clean up a .par file
The '.par' parameter files are just .perltidyrc files, and they can be quite