--variable-maximum-line-length
--want-trailing-commas='b'
+==> b1390.in <==
+ seek
+ (
+ FH,
+ $end,
+ 0
+ ,
+
+ )
+ ;
+
+ seek
+ (
+ FH,
+ $end,
+ 0
+
+ )
+ ;
+
+==> b1390.par <==
+--add-trailing-commas
+--delete-trailing-commas
+--maximum-line-length=1
+--want-trailing-commas='h'
+
+==> b1392.in <==
+if ( ioctl ( STDERR, $TIOCGWINSZ,
+ $winsize, )
+ ) {
+ ...;
+}
+
+if ( ioctl ( STDERR, $TIOCGWINSZ, $winsize
+ )
+ )
+{
+ ...;
+}
+
+==> b1392.par <==
+--add-trailing-commas
+--delete-trailing-commas
+--extended-line-up-parentheses
+--ignore-old-breakpoints
+--indent-columns=10
+--maximum-line-length=45
+--paren-vertical-tightness=2
+--space-keyword-paren
+--want-trailing-commas='b'
+
==> b140.in <==
$cmd[ $i ]=[
$s, $e, $cmd, \@hunk, $i ] ;
$line_up_parentheses_control_is_lxpl,
%trailing_comma_rules,
+ $wtc_cutoff_level,
# regex patterns for text identification.
# Most are initialized in a sub make_**_pattern during configuration.
initialize_keep_old_breakpoints( $rOpts->{'keep-old-breakpoints-after'},
'kba', \%keep_break_after_type );
- %trailing_comma_rules = ();
- initialize_trailing_comma_rules();
-
#------------------------------------------------------------
# Make global vars for frequently used options for efficiency
#------------------------------------------------------------
$stress_level_beta = $level;
}
+ %trailing_comma_rules = ();
+ initialize_trailing_comma_rules();
+
initialize_weld_nested_exclusion_rules();
initialize_weld_fat_comma_rules();
# if -atc set will add these
# if -dtc set will delete other trailing commas
+ # This routine must be called after the alpha and beta stress levels
+ # have been defined.
+
my $rvalid_flags = [qw(0 1 * m b h)];
my $option = $rOpts->{'want-trailing-commas'};
%trailing_comma_rules = %rule_hash;
}
}
+
+ # Adding and deleting under stress can lead to instability.
+ # So we define an indentation level above which we shut things down
+ # if both adding and deleting trailing commas are requested.
+ # This fixes b1389, b1390, b1391, b1392.
+ if ( $rOpts_add_trailing_commas && $rOpts_delete_trailing_commas ) {
+
+ # This is the same as the $lp_cutoff_level used to shut down -lp:
+ $wtc_cutoff_level = min( $stress_level_alpha, $stress_level_beta + 2 );
+
+ # If the level is zero, then we can turn off everything right now.
+ if ( $wtc_cutoff_level < 1 ) {
+ %trailing_comma_rules = ();
+ $rOpts_add_trailing_commas = 0;
+ $rOpts_delete_trailing_commas = 0;
+ }
+ }
+
return;
}
my $type_p = $rLL_new->[$Kp]->[_TYPE_];
return if ( $type_p eq '#' );
+ return
+ if ( defined($wtc_cutoff_level)
+ && $rLL_new->[$Kp]->[_LEVEL_] >= $wtc_cutoff_level );
+
# see if the user wants a trailing comma here
my $match =
$self->match_trailing_comma_rule( $KK, $Kfirst, $trailing_comma_rule, 1 );
return;
}
+ return
+ if ( defined($wtc_cutoff_level)
+ && $rLL_new->[$Kp]->[_LEVEL_] >= $wtc_cutoff_level );
+
# See if the user wants this trailing comma
my $match =
$self->match_trailing_comma_rule( $KK, $Kfirst, $trailing_comma_rule, 0 );