- 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.
=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
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>
'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
}
}
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;
+++ /dev/null
-# 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" },
-};
../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
#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'
'fpva2' => "-sfp -nfpva",
'git54' => "-bbp=3 -bbpi=2 -ci=4 -lp",
'lpxl1' => "-lp",
- 'lpxl2' => "-lfp",
'lpxl3' => <<'----------',
-lp -lpxl='{ [ ('
----------
#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
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
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
dog => { prowl => "growl", pool => "drool" },
mouse => { nibble => "kibble" },
};
-#11...........
+#10...........
},
};