From: Steve Hancock Date: Wed, 5 Jan 2022 02:19:41 +0000 (-0800) Subject: fix b1300, turn off -bbx under stress X-Git-Tag: 20211029.06~29 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=89626b2b5243cc72694068729b23be937dc1961f;p=perltidy.git fix b1300, turn off -bbx under stress --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index c3439cef..1871c968 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -8865,6 +8865,32 @@ my $file = $menubar->Menubutton( --indent-columns=8 --maximum-line-length=65 +==> b1300.in <== +$obj = { + foo => + [ + {a => "b"}, + 0, 1, 2 + ] +}; + +$obj = { + foo => + [ + {a => "b"}, 0, 1, 2 + ] +}; + +==> b1300.par <== +--brace-tightness=2 +--break-before-square-bracket-and-indent=2 +--break-before-square-bracket=2 +--continuation-indentation=9 +--ignore-old-breakpoints +--indent-columns=3 +--maximum-line-length=29 +--variable-maximum-line-length + ==> b1301.in <== subtest '->save' => sub { plan tests => 1; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 63f66a84..8c687eac 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -9803,6 +9803,15 @@ sub break_before_list_opening_containers { my $break_option = $break_before_container_types{$token}; next unless ($break_option); + # Do not use -bbx under stress for stability ... fixes b1300 + my $level = $rLL->[$KK]->[_LEVEL_]; + if ( $level >= $stress_level_beta ) { + DEBUG_BBX + && print +"BBX: Switching off at $seqno: level=$level exceeds beta stress level=$stress_level_beta\n"; + next; + } + # Require previous nonblank to be '=' or '=>' my $Kprev = $KK - 1; next if ( $Kprev < 0 ); @@ -9968,7 +9977,6 @@ sub break_before_list_opening_containers { # single line. Use the least possble indentation in the estmate (ci=0), # so we are not subtracting $ci * $rOpts_continuation_indentation from # tablulated $maximum_text_length value. - my $level = $rLL->[$KK]->[_LEVEL_]; my $maximum_text_length = $maximum_text_length_at_level[$level]; my $K_closing = $K_closing_container->{$seqno}; my $length = $self->cumulative_length_before_K($K_closing) -