From 3353c878b8b85c47643aee5ff1a9597f70a22ed0 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 16 Apr 2024 17:06:22 -0700 Subject: [PATCH] bump to version 20240202.06 --- CHANGES.md | 26 +++++++++- bin/perltidy | 41 ++++++++++++---- docs/ChangeLog.html | 28 ++++++++++- docs/Tidy.html | 2 +- docs/perltidy.html | 37 ++++++++++---- lib/Perl/Tidy.pm | 2 +- 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 | 2 +- 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/git137.def | 12 +++++ t/snippets/expect/git137.git137 | 12 +++++ t/snippets/git137.in | 12 +++++ t/snippets/git137.par | 1 + t/snippets/packing_list.txt | 2 + t/snippets29.t | 56 ++++++++++++++++++++++ 26 files changed, 224 insertions(+), 35 deletions(-) create mode 100644 t/snippets/expect/git137.def create mode 100644 t/snippets/expect/git137.git137 create mode 100644 t/snippets/git137.in create mode 100644 t/snippets/git137.par diff --git a/CHANGES.md b/CHANGES.md index 225c96f2..cb76569f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,30 @@ # Perltidy Change Log -## 2024 02 02.05 +## 2024 02 02.06 + + - Add option --minimize-continuation-indentation, -mci (see git #137). + This flag allows perltidy to remove continuation indentation in some + special cases where it is not really unnecessary. For a simple example, + the default formatting for the following snippet is: + + # perltidy -nmci + $self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); + + The second and third lines are one level deep in a container, and + are also statement continuations, so they get indented by the sum + of the -i value and the -ci value. If this flag is set, the + indentation is reduced by -ci spaces, giving + + # perltidy -mci + $self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); + + This situation is relatively rare except in code which has long + quoted strings and the -nolq flag is also set. This flag is currently + off by default, but it could become the default in a future version. - Add options --dump-mismatched-args (or -dma) and --warn-mismatched-arg (or -wma). These options look diff --git a/bin/perltidy b/bin/perltidy index 445eb321..2e5c0f0c 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -803,6 +803,30 @@ improve indentation of some multi-line qw lists as shown below. ) ) +=item B<-mci>, B<--minimize-continuation-indentation> + +This flag allows perltidy to remove continuation indentation in some +special cases where it is not really unnecessary. For a simple example, +the default formatting for the following snippet is: + + # perltidy -nmci + $self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); + +The second and third lines are one level deep in a container, and are also +statement continuations, so they get indented by the sum of the B<-i> +value and the B<-ci> value. If this flag is set, the indentation is reduced by +B<-ci> spaces, giving + + # perltidy -mci + $self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); + +This flag is currently off by default, but it could become the default in a +future version. + =item B<-sil=n> B<--starting-indentation-level=n> By default, perltidy examines the input file and tries to determine the @@ -6499,13 +6523,14 @@ The following list shows all short parameter names which allow a prefix hico hih hihh hii hij hik him hin hip hipd hipu hiq his hisc hiv hiw hsc html ibc icb icp iob ipc isbc iscl kgb kgbd kgbi kis lal - log lop lp lsl mem nib ohbr okw ola olc - oll olq opr opt osbc osbr otr ple pod pvl - q sac sbc sbl scbb schb scp scsb sct se - sfp sfs skp sob sobb sohb sop sosb sot ssc - st sts t tac tbc toc tp tqw trp ts - tsc tso vbc vc viu vmll vsc vsn vwe w - wfc wia wma wme wn x xbt xci xlp xs + log lop lp lsl mci mem nib ohbr okw ola + olc oll olq opr opt osbc osbr otr ple pod + pvl q sac sbc sbl scbb schb scp scsb sct + se sfp sfs skp sob sobb sohb sop sosb sot + ssc st sts t tac tbc toc tp tqw trp + ts tsc tso vbc vc viu vmll vsc vsn vwe + w wfc wia wma wme wn x xbt xci xlp + xs Equivalently, the prefix 'no' or 'no-' on the corresponding long names may be used. @@ -6604,7 +6629,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20240202.05 +This man page documents perltidy version 20240202.06 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index 650603f8..4fa3750b 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,8 +1,32 @@

Perltidy Change Log

-

2024 02 02.05

+

2024 02 02.06

-
- Add options --dump-mismatched-args (or -dma) and
+
- Add option --minimize-continuation-indentation, -mci (see git #137).
+  This flag allows perltidy to remove continuation indentation in some
+  special cases where it is not really unnecessary. For a simple example,
+  the default formatting for the following snippet is:
+
+    # perltidy -nmci
+    $self->blurt( "Error: No INPUT definition for type '$type', typekind '"
+          . $type->xstype
+          . "' found" );
+
+  The second and third lines are one level deep in a container, and
+  are also statement continuations, so they get indented by the sum
+  of the -i value and the -ci value.  If this flag is set, the
+  indentation is reduced by -ci spaces, giving
+
+    # perltidy -mci
+    $self->blurt( "Error: No INPUT definition for type '$type', typekind '"
+        . $type->xstype
+        . "' found" );
+
+  This situation is relatively rare except in code which has long
+  quoted strings and the -nolq flag is also set.  This flag is currently
+  off by default, but it could become the default in a future version.
+
+- Add options --dump-mismatched-args (or -dma) and
   --warn-mismatched-arg (or -wma).  These options look
   for and report instances where the number of args expected by a
   sub appear to differ from the number passed to the sub.  The -dump
diff --git a/docs/Tidy.html b/docs/Tidy.html
index cbc9a9a5..8df05c10 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20240202.05

+

This man page documents Perl::Tidy version 20240202.06

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index 1133e0f3..fe82ef47 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -621,6 +621,26 @@ ) )
+ +
-mci, --minimize-continuation-indentation
+
+ +

This flag allows perltidy to remove continuation indentation in some special cases where it is not really unnecessary. For a simple example, the default formatting for the following snippet is:

+ +
        # perltidy -nmci
+        $self->blurt( "Error: No INPUT definition for type '$type', typekind '"
+              . $type->xstype
+              . "' found" );
+ +

The second and third lines are one level deep in a container, and are also statement continuations, so they get indented by the sum of the -i value and the -ci value. If this flag is set, the indentation is reduced by -ci spaces, giving

+ +
        # perltidy -mci
+        $self->blurt( "Error: No INPUT definition for type '$type', typekind '"
+            . $type->xstype
+            . "' found" );
+ +

This flag is currently off by default, but it could become the default in a future version.

+
-sil=n --starting-indentation-level=n
@@ -5075,13 +5095,14 @@ hico hih hihh hii hij hik him hin hip hipd hipu hiq his hisc hiv hiw hsc html ibc icb icp iob ipc isbc iscl kgb kgbd kgbi kis lal - log lop lp lsl mem nib ohbr okw ola olc - oll olq opr opt osbc osbr otr ple pod pvl - q sac sbc sbl scbb schb scp scsb sct se - sfp sfs skp sob sobb sohb sop sosb sot ssc - st sts t tac tbc toc tp tqw trp ts - tsc tso vbc vc viu vmll vsc vsn vwe w - wfc wia wma wme wn x xbt xci xlp xs
+ log lop lp lsl mci mem nib ohbr okw ola + olc oll olq opr opt osbc osbr otr ple pod + pvl q sac sbc sbl scbb schb scp scsb sct + se sfp sfs skp sob sobb sohb sop sosb sot + ssc st sts t tac tbc toc tp tqw trp + ts tsc tso vbc vc viu vmll vsc vsn vwe + w wfc wia wma wme wn x xbt xci xlp + xs

Equivalently, the prefix 'no' or 'no-' on the corresponding long names may be used.

@@ -5159,7 +5180,7 @@

VERSION

-

This man page documents perltidy version 20240202.05

+

This man page documents perltidy version 20240202.06

BUG REPORTS

diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 18e1f671..3542d5bf 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.05'; + $VERSION = '20240202.06'; } ## end BEGIN sub DESTROY { diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index fdf186dc..62bbbf2f 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.05 +This man page documents Perl::Tidy version 20240202.06 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 2ff051b3..59bfa3f9 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.05'; +our $VERSION = '20240202.06'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index 7da17374..428bfedb 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.05'; +our $VERSION = '20240202.06'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index bb67d131..75ceb537 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.05'; +our $VERSION = '20240202.06'; 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 7827809a..46417e33 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.05'; +our $VERSION = '20240202.06'; # 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 57d9a9a8..2ce6eb79 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.05'; +our $VERSION = '20240202.06'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index d6842e0d..4e7d95ff 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.05'; +our $VERSION = '20240202.06'; 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 2ac09d6a..27f217d2 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.05'; +our $VERSION = '20240202.06'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index ab1d6a39..f66d86e7 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.05'; +our $VERSION = '20240202.06'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index b4dcbddc..c6f08c8e 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.05'; +our $VERSION = '20240202.06'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index e9303f0d..d2170229 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.05'; +our $VERSION = '20240202.06'; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 6a82ba8f..d6353adc 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.05'; +our $VERSION = '20240202.06'; use English qw( -no_match_vars ); use Scalar::Util 'refaddr'; use Perl::Tidy::VerticalAligner::Alignment; diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index ef9cc9b3..bb766d3a 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.05'; +our $VERSION = '20240202.06'; sub new { my ( $class, $rarg ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index 58b949d2..395a49f0 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.05'; +our $VERSION = '20240202.06'; use English qw( -no_match_vars ); sub AUTOLOAD { diff --git a/t/snippets/expect/git137.def b/t/snippets/expect/git137.def new file mode 100644 index 00000000..6e98f6f2 --- /dev/null +++ b/t/snippets/expect/git137.def @@ -0,0 +1,12 @@ +generate_error( msg => +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +); + +subtype 'USState' => as Str => where { + ( exists $STATES->{code2state}{ uc($_) } + || exists $STATES->{state2code}{ uc($_) } ); +}; + +$self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); diff --git a/t/snippets/expect/git137.git137 b/t/snippets/expect/git137.git137 new file mode 100644 index 00000000..6215bfd2 --- /dev/null +++ b/t/snippets/expect/git137.git137 @@ -0,0 +1,12 @@ +generate_error( msg => + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +); + +subtype 'USState' => as Str => where { + ( exists $STATES->{code2state}{ uc($_) } + || exists $STATES->{state2code}{ uc($_) } ); +}; + +$self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); diff --git a/t/snippets/git137.in b/t/snippets/git137.in new file mode 100644 index 00000000..6e98f6f2 --- /dev/null +++ b/t/snippets/git137.in @@ -0,0 +1,12 @@ +generate_error( msg => +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +); + +subtype 'USState' => as Str => where { + ( exists $STATES->{code2state}{ uc($_) } + || exists $STATES->{state2code}{ uc($_) } ); +}; + +$self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); diff --git a/t/snippets/git137.par b/t/snippets/git137.par new file mode 100644 index 00000000..ec59fae2 --- /dev/null +++ b/t/snippets/git137.par @@ -0,0 +1 @@ +-mci -nolq -ci=4 diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 46b998b5..23bce5f7 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -557,3 +557,5 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def +../snippets29.t git137.def +../snippets29.t git137.git137 diff --git a/t/snippets29.t b/t/snippets29.t index 2018287c..2b430cf0 100644 --- a/t/snippets29.t +++ b/t/snippets29.t @@ -15,6 +15,8 @@ #12 c352.def #13 c353.c353 #14 c353.def +#15 git137.def +#16 git137.git137 # To locate test #13 you can search for its name or the string '#13' @@ -45,6 +47,7 @@ BEGIN { ---------- 'git125' => "-ssp=0", 'git135' => "--valign-wide-equals", + 'git137' => "-mci -nolq -ci=4", 'vsn1' => <<'----------', -vsn -gnu @@ -174,6 +177,21 @@ $mask = ~( ~$mask | $DeadBits{$word} ) if $no_fatal; $height = $row * 25 if $row * 25 < $height; }}} +---------- + + 'git137' => <<'----------', +generate_error( msg => +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +); + +subtype 'USState' => as Str => where { + ( exists $STATES->{code2state}{ uc($_) } + || exists $STATES->{state2code}{ uc($_) } ); +}; + +$self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); ---------- 'vsn' => <<'----------', @@ -548,6 +566,44 @@ $map = $DEFAULT_PATH . "/" . $map unless $map =~ m|/|; $map .= $DEFAULT_EXT unless $map =~ m|/[^/]+\.[^/]+$|; #14........... }, + + 'git137.def' => { + source => "git137", + params => "def", + expect => <<'#15...........', +generate_error( msg => +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +); + +subtype 'USState' => as Str => where { + ( exists $STATES->{code2state}{ uc($_) } + || exists $STATES->{state2code}{ uc($_) } ); +}; + +$self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); +#15........... + }, + + 'git137.git137' => { + source => "git137", + params => "git137", + expect => <<'#16...........', +generate_error( msg => + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +); + +subtype 'USState' => as Str => where { + ( exists $STATES->{code2state}{ uc($_) } + || exists $STATES->{state2code}{ uc($_) } ); +}; + +$self->blurt( "Error: No INPUT definition for type '$type', typekind '" + . $type->xstype + . "' found" ); +#16........... + }, }; my $ntests = 0 + keys %{$rtests}; -- 2.39.5