]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1300, turn off -bbx under stress
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 5 Jan 2022 02:19:41 +0000 (18:19 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 5 Jan 2022 02:19:41 +0000 (18:19 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index c3439cef6809e2a8732999205d8cba6412dcd6b2..1871c9687b8e8eb01bba01441dc2a90c661b8663 100644 (file)
@@ -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;
index 63f66a84f8071cc8caab1e4a3da12b595dfadbd6..8c687eac6fb118ecf7ba765a1190aa162f9a6892 100644 (file)
@@ -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) -