From e2239833be343bfb8d9f269cb20a71666272e644 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Thu, 2 Jun 2022 06:49:22 -0700 Subject: [PATCH] add restrictions on use of -kba and -kbb --- lib/Perl/Tidy/Formatter.pm | 48 ++++++-------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 7687ffbc..e55bf05c 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -52,7 +52,7 @@ use constant SPACE => q{ }; use Carp; use English qw( -no_match_vars ); -our $VERSION = '20220601'; +our $VERSION = '20220613'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() @@ -2305,9 +2305,13 @@ list is: @list; EOM } - # ignore kbb='(' : can cause unstable math formatting (issue b1346) + # Ignore kbb='(' and '[' and '{': can cause unstable math formatting + # (issues b1346, b1347, b1348) and likewise ignore kba=')' and ']' and '}' if ( $short_name eq 'kbb' ) { - @list = grep { !m/\(/ } @list; + @list = grep { !m/[\(\[\{]/ } @list; + } + elsif ( $short_name eq 'kba' ) { + @list = grep { !m/[\)\]\}]/ } @list; } # pull out any any leading container code, like f( or *{ @@ -2359,44 +2363,6 @@ EOM $rkeep_break_hash->{$key} = $flag; } - # Temporary patch and warning during changeover from using type to token for - # containers . This can be eliminated after one or two future releases. - if ( $rkeep_break_hash->{'{'} - && $rkeep_break_hash->{'{'} eq '1' - && !$rkeep_break_hash->{'('} - && !$rkeep_break_hash->{'['} ) - { - $rkeep_break_hash->{'('} = 1; - $rkeep_break_hash->{'['} = 1; - Warn(<{'}'} - && $rkeep_break_hash->{'}'} eq '1' - && !$rkeep_break_hash->{')'} - && !$rkeep_break_hash->{']'} ) - { - $rkeep_break_hash->{')'} = 1; - $rkeep_break_hash->{']'} = 1; - Warn(<