]> git.donarmstrong.com Git - perltidy.git/commitdiff
remove -lfp shortcut pending further testing
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 Mar 2021 14:35:43 +0000 (07:35 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 Mar 2021 14:35:43 +0000 (07:35 -0700)
CHANGES.md
bin/perltidy
lib/Perl/Tidy.pm
lib/Perl/Tidy/Formatter.pm
t/snippets/expect/lpxl.lpxl2 [deleted file]
t/snippets/lpxl2.par [deleted file]
t/snippets/packing_list.txt
t/snippets24.t

index 2dac997a92ad93ed8c7e5dbbbe902f881341cb9a..0d3a180a17163ecf677fc2ee4377b08221840e24 100644 (file)
@@ -4,8 +4,8 @@
 
     - Fixed issue git #57 regarding uninitialized warning flag.
 
-    - Added flag -lpxl for issue git #56, providing some control over which
-    containers get -lp indentation. 
+    - Added experimental flag -lpxl=s requested in issue git #56 to provide some
+    control over which containers get -lp indentation.
 
     - Fixed issue git #55 regarding lack of coordination of the --break-before-xxx
     flags and the --line-up-parens flag.
index 0ddb9529ba72fab52520d0f19b0123894abb00f8..6fb4f5606c1dbb61360b971eb7be28eb9054c38c 100755 (executable)
@@ -844,9 +844,12 @@ hierarchical lists, and these flags may prevent that.
 
 =item B<-lpxl=s>,  B<--line-up-parentheses-exclusion-list>
 
+This is an experimental parameter; the details might change as experience
+with it is gained.
+
 The B<-lp> indentation style works well for some types of coding but can
 produce very long lines when variables have long names and/or containers are
-very deeply nested.  The B<-lpxl=s> flag can help mitigate this problem by
+very deeply nested.  The B<-lpxl=s> flag is intended to help mitigate this problem by
 providing control over the containers to which the B<-lp> indentation style is
 applied.  The B<-lp> flag by default is "greedy" and applies to as many
 containers as possible.  This flag specifies a list of things which should
@@ -897,36 +900,9 @@ For example,
 
 means only apply -lp to parenthesized lists which follow a function call and
 which do not contain any sublists, code blocks or ternary expressions.  The logic
-of writing these codes is counter-intuitive because they describe what is not
+of writing these codes is somewhat counter-intuitive because they describe what is not
 getting the -lp indentation.  So the 'F' indicates that non-function calls are
 not getting -lp, or in other words that function calls are getting the -lp indentation.
-To simplify things, the next section has a shortcut form for the previous
-example, since it is expected to be the most useful.
-
-=item B<-lfp>,  B<--line-up-function-parentheses>
-
-This is a shortcut for
-
-  -lp -lpxl = '[ { F(2'
-
-which means only apply -lp to parenthesized lists which follow a function call
-and which do not contain any sublists, code blocks or ternary expressions. For
-example,
-
-    # perltidy -lfp
-    my $loanlength = getLoanLength(
-                                    $borrower->{'categorycode'},
-                                    $iteminformation->{'itemtype'},
-                                    $borrower->{'branchcode'}
-    );
-
-    # perltidy -lfp
-    @month_of_year = (
-        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
-    );
-
-The first of these examples is a simple function call, but the second is not.
 
 =item B<-cti=n>, B<--closing-token-indentation>
 
index 3eac01bf7802a34070d1c895da91efa992a5f052..13f4bf3ea83c37c2df8b19de62af794270d222cc 100644 (file)
@@ -2784,8 +2784,10 @@ sub generate_options {
         'conv'       => [qw(it=4)],
         'nconv'      => [qw(it=1)],
 
-        'line-up-function-parentheses' => [ qw(lp), q#lpxl=[ { F(2# ],
-        'lfp'                          => [qw(line-up-function-parentheses)],
+        # FIXME: possible future shortcut.  This will remain deactivated until
+        # the -lpxl flag is no longer experimental.
+        # 'line-up-function-parentheses' => [ qw(lp), q#lpxl=[ { F(2# ],
+        # 'lfp'                          => [qw(line-up-function-parentheses)],
 
         # 'mangle' originally deleted pod and comments, but to keep it
         # reversible, it no longer does.  But if you really want to
index 4899bc3fd3f0b0e3e7129b60c035ac1504fb6de5..d3b96de41d9712c0ca1bfd1ddd27c089ae4afcad 100644 (file)
@@ -1816,7 +1816,13 @@ EOM
         }
     }
     if ($all_off) {
-        $rOpts->{'line-up-parentheses'} = "";
+
+        # FIXME: This works but is currently deactivated because at present
+        # users of -lp could see some discontinuities in formatting,
+        # such as those involving the choice of breaks at '='.  After
+        # these issues have been checked and resolved it should be reactivated
+        # as a speedup.
+        ## $rOpts->{'line-up-parentheses'} = "";
     }
 
     return;
diff --git a/t/snippets/expect/lpxl.lpxl2 b/t/snippets/expect/lpxl.lpxl2
deleted file mode 100644 (file)
index 0c7a829..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# simple function call
-my $loanlength = getLoanLength(
-                                $borrower->{'categorycode'},    # sc1
-                                $iteminformation->{'itemtype'},
-                                $borrower->{'branchcode'}       # sc3
-);
-
-# function call, more than one level deep
-my $o = very::long::class::name->new(
-    {
-        propA => "a",
-        propB => "b",
-        propC => "c",
-    }
-);
-
-# function call with sublist
-debug(
-    "Connecting to DB.",
-    "Extra-Parameters: " . join( "<->", $extra_parms ),
-    "Config: " . join( "<->", %config )
-);
-
-# simple function call with code block
-$m->command(
-    -label   => 'Save',
-    -command => sub { print "DOS\n"; save_dialog($win); } );
-
-# function call, ternary in list
-return
-  OptArgs2::Result->usage(
-    $style == OptArgs2::STYLE_FULL ? 'FullUsage' : 'NormalUsage',
-    'usage: ' . $usage . "\n" );
-
-# not a function call
-%blastparam = (
-    -run    => \%runparam,
-    -file   => '',
-    -parse  => 1,
-    -signif => 1e-5,
-);
-
-# 'local' is a keyword, not a user function
-local (
-    $len,    $pts,      @colspec, $char, $cols,
-    $repeat, $celldata, $at_text, $after_text
-);
-
-# square bracket with sublists
-$data = [
-    ListElem->new( id => 0, val => 100 ),
-    ListElem->new( id => 2, val => 50 ),
-    ListElem->new( id => 1, val => 10 ),
-];
-
-# curly brace with sublists
-$behaviour = {
-    cat   => { nap    => "lap",   eat  => "meat" },
-    dog   => { prowl  => "growl", pool => "drool" },
-    mouse => { nibble => "kibble" },
-};
diff --git a/t/snippets/lpxl2.par b/t/snippets/lpxl2.par
deleted file mode 100644 (file)
index eced01c..0000000
+++ /dev/null
@@ -1 +0,0 @@
--lfp
index fe98992e4b7666156fbe79dee968576d48069228..6bcd97e3475ec952814980e0013465e3ec132071 100644 (file)
 ../snippets24.t        fpva.def
 ../snippets24.t        fpva.fpva1
 ../snippets24.t        fpva.fpva2
+../snippets24.t        lpxl.def
+../snippets24.t        lpxl.lpxl1
+../snippets24.t        lpxl.lpxl2
+../snippets24.t        lpxl.lpxl3
+../snippets24.t        lpxl.lpxl4
+../snippets24.t        lpxl.lpxl5
 ../snippets3.t ce_wn1.ce_wn
 ../snippets3.t ce_wn1.def
 ../snippets3.t colin.colin
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets24.t        lpxl.def
-../snippets24.t        lpxl.lpxl1
-../snippets24.t        lpxl.lpxl2
-../snippets24.t        lpxl.lpxl3
-../snippets24.t        lpxl.lpxl4
-../snippets24.t        lpxl.lpxl5
index 36c2c886455ebb2f22c13672fc6c01475cd3a443..c6ab7e245bc3a2fa1ec28e405f75225a73ab279e 100644 (file)
@@ -8,10 +8,9 @@
 #5 fpva.fpva2
 #6 lpxl.def
 #7 lpxl.lpxl1
-#8 lpxl.lpxl2
-#9 lpxl.lpxl3
-#10 lpxl.lpxl4
-#11 lpxl.lpxl5
+#8 lpxl.lpxl3
+#9 lpxl.lpxl4
+#10 lpxl.lpxl5
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -34,7 +33,6 @@ BEGIN {
         'fpva2' => "-sfp -nfpva",
         'git54' => "-bbp=3 -bbpi=2 -ci=4 -lp",
         'lpxl1' => "-lp",
-        'lpxl2' => "-lfp",
         'lpxl3' => <<'----------',
 -lp -lpxl='{ [ ('
 ----------
@@ -469,78 +467,10 @@ $behaviour = {
 #7...........
         },
 
-        'lpxl.lpxl2' => {
-            source => "lpxl",
-            params => "lpxl2",
-            expect => <<'#8...........',
-# simple function call
-my $loanlength = getLoanLength(
-                                $borrower->{'categorycode'},    # sc1
-                                $iteminformation->{'itemtype'},
-                                $borrower->{'branchcode'}       # sc3
-);
-
-# function call, more than one level deep
-my $o = very::long::class::name->new(
-    {
-        propA => "a",
-        propB => "b",
-        propC => "c",
-    }
-);
-
-# function call with sublist
-debug(
-    "Connecting to DB.",
-    "Extra-Parameters: " . join( "<->", $extra_parms ),
-    "Config: " . join( "<->", %config )
-);
-
-# simple function call with code block
-$m->command(
-    -label   => 'Save',
-    -command => sub { print "DOS\n"; save_dialog($win); } );
-
-# function call, ternary in list
-return
-  OptArgs2::Result->usage(
-    $style == OptArgs2::STYLE_FULL ? 'FullUsage' : 'NormalUsage',
-    'usage: ' . $usage . "\n" );
-
-# not a function call
-%blastparam = (
-    -run    => \%runparam,
-    -file   => '',
-    -parse  => 1,
-    -signif => 1e-5,
-);
-
-# 'local' is a keyword, not a user function
-local (
-    $len,    $pts,      @colspec, $char, $cols,
-    $repeat, $celldata, $at_text, $after_text
-);
-
-# square bracket with sublists
-$data = [
-    ListElem->new( id => 0, val => 100 ),
-    ListElem->new( id => 2, val => 50 ),
-    ListElem->new( id => 1, val => 10 ),
-];
-
-# curly brace with sublists
-$behaviour = {
-    cat   => { nap    => "lap",   eat  => "meat" },
-    dog   => { prowl  => "growl", pool => "drool" },
-    mouse => { nibble => "kibble" },
-};
-#8...........
-        },
-
         'lpxl.lpxl3' => {
             source => "lpxl",
             params => "lpxl3",
-            expect => <<'#9...........',
+            expect => <<'#8...........',
 # simple function call
 my $loanlength = getLoanLength(
     $borrower->{'categorycode'},    # sc1
@@ -602,13 +532,13 @@ $behaviour = {
     dog   => { prowl  => "growl", pool => "drool" },
     mouse => { nibble => "kibble" },
 };
-#9...........
+#8...........
         },
 
         'lpxl.lpxl4' => {
             source => "lpxl",
             params => "lpxl4",
-            expect => <<'#10...........',
+            expect => <<'#9...........',
 # simple function call
 my $loanlength = getLoanLength(
                                 $borrower->{'categorycode'},    # sc1
@@ -669,13 +599,13 @@ $behaviour = {
     dog   => { prowl  => "growl", pool => "drool" },
     mouse => { nibble => "kibble" },
 };
-#10...........
+#9...........
         },
 
         'lpxl.lpxl5' => {
             source => "lpxl",
             params => "lpxl5",
-            expect => <<'#11...........',
+            expect => <<'#10...........',
 # simple function call
 my $loanlength = getLoanLength(
                                 $borrower->{'categorycode'},    # sc1
@@ -737,7 +667,7 @@ $behaviour = {
     dog   => { prowl  => "growl", pool => "drool" },
     mouse => { nibble => "kibble" },
 };
-#11...........
+#10...........
         },
     };