]> git.donarmstrong.com Git - perltidy.git/commitdiff
bump to version 20240202.06 20240202.06
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 17 Apr 2024 00:06:22 +0000 (17:06 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 17 Apr 2024 00:06:22 +0000 (17:06 -0700)
26 files changed:
CHANGES.md
bin/perltidy
docs/ChangeLog.html
docs/Tidy.html
docs/perltidy.html
lib/Perl/Tidy.pm
lib/Perl/Tidy.pod
lib/Perl/Tidy/Debugger.pm
lib/Perl/Tidy/Diagnostics.pm
lib/Perl/Tidy/FileWriter.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/HtmlWriter.pm
lib/Perl/Tidy/IOScalar.pm
lib/Perl/Tidy/IOScalarArray.pm
lib/Perl/Tidy/IndentationItem.pm
lib/Perl/Tidy/Logger.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm
lib/Perl/Tidy/VerticalAligner/Alignment.pm
lib/Perl/Tidy/VerticalAligner/Line.pm
t/snippets/expect/git137.def [new file with mode: 0644]
t/snippets/expect/git137.git137 [new file with mode: 0644]
t/snippets/git137.in [new file with mode: 0644]
t/snippets/git137.par [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets29.t

index 225c96f243569682e7fa8a4021cdeac8a2653bc1..cb76569f7ec98acae6d8f4931b3ae8702a27452a 100644 (file)
@@ -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
index 445eb321802790a53d3db883688f3c0b23f490e8..2e5c0f0cf7f8382db714a6fa1d48c21e8b061c07 100755 (executable)
@@ -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
 
index 650603f853427711099ff0239321a4daff8b3fa2..4fa3750bb47163251ad84d47199e09a4c44316e4 100644 (file)
@@ -1,8 +1,32 @@
 <h1>Perltidy Change Log</h1>
 
-<h2>2024 02 02.05</h2>
+<h2>2024 02 02.06</h2>
 
-<pre><code>- Add options --dump-mismatched-args (or -dma) and
+<pre><code>- 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-&gt;blurt( "Error: No INPUT definition for type '$type', typekind '"
+          . $type-&gt;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-&gt;blurt( "Error: No INPUT definition for type '$type', typekind '"
+        . $type-&gt;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
index cbc9a9a51ef64369186d1a2662f2722ad698411b..8df05c10d8623a38f4d9c0fceef7cf0379838758 100644 (file)
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents Perl::Tidy version 20240202.05</p>
+<p>This man page documents Perl::Tidy version 20240202.06</p>
 
 <h1 id="LICENSE">LICENSE</h1>
 
index 1133e0f37cf44089287bc1ce438460df82a9b549..fe82ef47b9f96f8b61134fe2ab13136b137ea028 100644 (file)
                 )
               )</code></pre>
 
+</dd>
+<dt id="mci---minimize-continuation-indentation"><b>-mci</b>, <b>--minimize-continuation-indentation</b></dt>
+<dd>
+
+<p>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:</p>
+
+<pre><code>        # perltidy -nmci
+        $self-&gt;blurt( &quot;Error: No INPUT definition for type &#39;$type&#39;, typekind &#39;&quot;
+              . $type-&gt;xstype
+              . &quot;&#39; found&quot; );</code></pre>
+
+<p>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</b> value and the <b>-ci</b> value. If this flag is set, the indentation is reduced by <b>-ci</b> spaces, giving</p>
+
+<pre><code>        # perltidy -mci
+        $self-&gt;blurt( &quot;Error: No INPUT definition for type &#39;$type&#39;, typekind &#39;&quot;
+            . $type-&gt;xstype
+            . &quot;&#39; found&quot; );</code></pre>
+
+<p>This flag is currently off by default, but it could become the default in a future version.</p>
+
 </dd>
 <dt id="sil-n---starting-indentation-level-n"><b>-sil=n</b> <b>--starting-indentation-level=n</b></dt>
 <dd>
  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</code></pre>
+ 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</code></pre>
 
 <p>Equivalently, the prefix &#39;no&#39; or &#39;no-&#39; on the corresponding long names may be used.</p>
 
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents perltidy version 20240202.05</p>
+<p>This man page documents perltidy version 20240202.06</p>
 
 <h1 id="BUG-REPORTS">BUG REPORTS</h1>
 
index 18e1f67138eda09df3297f4a24f8a318b7e2e65f..3542d5bfedfbfde00e57399b2bc7b78ac1190d08 100644 (file)
@@ -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 {
index fdf186dc205b21858da9e478c301b719e4bf52e1..62bbbf2f0c033a704c7befb43d74a7c805eb893c 100644 (file)
@@ -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
 
index 2ff051b3062baa6da631cd79fdaac82e0a9b4f5a..59bfa3f934c745998ed53902ed6d609933d1e8e9 100644 (file)
@@ -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{ };
index 7da1737407e20d4f6acd4cb51fc468563d3c2970..428bfedbcefda61d108afe7d5d8b1012370ad18f 100644 (file)
@@ -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{};
 
index bb67d131e2b82d00e2acb414dbdf91c482c7eaf8..75ceb537a6847e009c71ca8b3dcb34157a05308b 100644 (file)
@@ -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{};
index 7827809a2747a9028353be10da83a5f8a37982f9..46417e331deea433df2639cf7cffdff290be6424 100644 (file)
@@ -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()
index 57d9a9a82b8976d700b36ff908c7dea5cfcedbe7..2ce6eb799955a938d93da63c8f0b1123d139685c 100644 (file)
@@ -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 );
index d6842e0d133e8f6d3d4780e199c56c1e7ca42034..4e7d95ff072a55ff1d8359d9b8b6d81009e175aa 100644 (file)
@@ -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{};
index 2ac09d6a243b245591b6bffeb4b025cee2ccf77c..27f217d24e62b5fbc3e994feee4ab7cc72aa81d5 100644 (file)
@@ -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;
 
index ab1d6a39b98847a8b42207b6498311f0d6723e61..f66d86e74c210d4df60e650356b0eac343d074f5 100644 (file)
@@ -9,7 +9,7 @@ package Perl::Tidy::IndentationItem;
 use strict;
 use warnings;
 
-our $VERSION = '20240202.05';
+our $VERSION = '20240202.06';
 
 BEGIN {
 
index b4dcbddc964de3cacbc566d1bdff297f3ea93be8..c6f08c8ecead2b18b91be134522414439bc56a47 100644 (file)
@@ -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 );
 
index e9303f0d7013103462dbf32d645ae5c9b8fcbcc9..d21702299154d257b407115a12b97174fbf8134d 100644 (file)
@@ -33,7 +33,7 @@ use strict;
 use warnings;
 use English qw( -no_match_vars );
 
-our $VERSION = '20240202.05';
+our $VERSION = '20240202.06';
 
 use Carp;
 
index 6a82ba8fa157bd1e223b4c10f576b3201ba4b4a2..d6353adc8bcda0e0bfc3d89321e912abe7d67978 100644 (file)
@@ -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;
index ef9cc9b32c1927ac8ae6062af7f047af0440b93c..bb766d3aee7d922ff247f4b65fc8abab7fc44a95 100644 (file)
@@ -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 ) = @_;
index 58b949d28b01e15be8147d236091f099fdcf40bd..395a49f0b851c68c77f46fbc9227360e3cfb5cc9 100644 (file)
@@ -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 (file)
index 0000000..6e98f6f
--- /dev/null
@@ -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 (file)
index 0000000..6215bfd
--- /dev/null
@@ -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 (file)
index 0000000..6e98f6f
--- /dev/null
@@ -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 (file)
index 0000000..ec59fae
--- /dev/null
@@ -0,0 +1 @@
+-mci -nolq -ci=4
index 46b998b561f6a867e21d75115308e64ac4ea7d91..23bce5f7c5ac75761de6842e2a415ce41122231b 100644 (file)
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
+../snippets29.t        git137.def
+../snippets29.t        git137.git137
index 2018287c998a4c8b550acf4b0e6ae815d4720429..2b430cf0aa8cbdb0af26aac0d2e7fb85a8db0707 100644 (file)
@@ -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};