s=0 : no list should have a trailing comma
s=1 or * : every list should have a trailing comma
- s=m a multi-line list should have a trailing commas
+ s=m a multi-line list should have a trailing comma
s=b trailing commas should be 'bare' (comma followed by newline)
s=h lists of key=>value pairs, with about one one '=>' and one ',' per line,
with a bare trailing comma
--noadd-whitespace
--qw-as-function
+==> b1487.in <==
+use Net::Domain qw(hostname domainname
+ hostdomain);
+use Net::Domain qw(
+ hostname
+ domainname
+ hostdomain
+);
+
+==> b1487.par <==
+--maximum-line-length=41
+--continuation-indentation=7
+--line-up-parentheses
+--noadd-whitespace
+--qw-as-function
+
+==> b1488.in <==
+use vars qw(
+ $VERSION @ISA
+ @EXPORT_OK %EXPORT_TAGS
+);
+use vars qw($VERSION @ISA
+ @EXPORT_OK %EXPORT_TAGS);
+
+==> b1488.par <==
+--maximum-line-length=48
+--continuation-indentation=6
+--noadd-whitespace
+--extended-line-up-parentheses
+--qw-as-function
+
==> b156.in <==
# State 1
{
return;
}
+ # The combination -naws -lp can currently be unstable for multi-line qw
+ # (b1487, b1488).
+ if ( !$rOpts_add_whitespace
+ && $rOpts_line_up_parentheses
+ && ( !$opening || !$closing ) )
+ {
+ return;
+ }
+
#---------------------------------------------------------------------
# This is the point of no return if the transformation has not started
#---------------------------------------------------------------------
$has_multiline_commas = $line_diff_commas > 0;
}
- # To avoid instability in edge cases, when adding commas we uses the
- # multiline_commas definition, but when deleting we use multiline
- # containers. This fixes b1384, b1396, b1397, b1398, b1400.
- # Added fat_comma_count to handle one-line with key=>value, git143
+ # To avoid instability in edge cases, we must make it somewhat easier
+ # to delete commas than to add commas. The following prescription
+ # fixes b1384, b1396, b1397, b1398, b1400.
my $is_multiline =
$if_add
- ? $has_multiline_commas || $has_multiline_containers && $fat_comma_count
+ ? $has_multiline_commas
: $has_multiline_containers;
- my $is_bare_multiline_comma = $is_multiline && $KK == $Kfirst;
+ # Old coding for bare comma, very stable:
+ # my $is_bare_multiline_comma = $KK == $Kfirst && $is_multiline;
+
+ # Testing new coding for bare comma adds fat_comma_count to handle adding
+ # comma to one-line with key=>value, git143
+ my $is_bare_multiline_comma = $KK == $Kfirst;
+ if ($if_add) {
+ $is_bare_multiline_comma &&= $has_multiline_commas || $fat_comma_count;
+ }
my $match;