From: Steve Hancock Date: Tue, 2 Jan 2024 01:43:13 +0000 (-0800) Subject: fix issue where -nwcp without -wcp was not working X-Git-Tag: 20230912.11~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4889c878404b530492346ecdd1dd8d5590a0764a;p=perltidy.git fix issue where -nwcp without -wcp was not working --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 7376d851..a16edb6f 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -9791,24 +9791,24 @@ sub dump_mixed_call_parens { my ( $no_count, $yes_count, $type ) = @{ $call_counts{$key} }; next unless ( $no_count && $yes_count ); - # display type 'U' as 's' on output for clarity and better sorted order - my $type_out = $type eq 'U' ? 's' : $type; push @mixed_counts, { name => $key, - type => $type_out, + type => $type, no_count => $no_count, yes_count => $yes_count }; } return unless (@mixed_counts); + + # sort on lc of type so that user sub type 'U' will come after 'k' my @sorted = - sort { $a->{type} cmp $b->{type} || $a->{name} cmp $b->{name} } + sort { lc $a->{type} cmp lc $b->{type} || $a->{name} cmp $b->{name} } @mixed_counts; my $output_string = <{$opt_name}; - return unless ($rOpts_warn_call_parens); + return unless (%call_paren_style); + my $opt_name = 'want-call-parens'; # Types which will be checked: # 'k'=builtin keyword, 'U'=user defined sub, 'w'=unknown bareword my %is_kwU = ( 'k' => 1, 'w' => 1, 'U' => 1 ); - # if no hash, user may have just entered -wcp='!' - return unless (%call_paren_style); - my $rwarnings = []; #---------------------