From: Steve Hancock Date: Wed, 14 Feb 2024 15:53:17 +0000 (-0800) Subject: make --delete-repeated-commas the default X-Git-Tag: 20240202.02~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d9103c0b5585b2bb177d3139b5c0832933da8397;p=perltidy.git make --delete-repeated-commas the default --- diff --git a/CHANGES.md b/CHANGES.md index 719c42c8..d94ae8f8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,16 +2,20 @@ ## 2024 02 02.01 - - The option --delete-repeated-commas, -drc has been expanded as follows: + - The option --delete-repeated-commas is now the default. + + It makes the following checks and changes: - Repeated commas like ',,' on the same line are removed with a warning - Repeated fat commas like '=> =>' on the same line are removed with a warning - - Repeated commas and fat commas on different lines remain unchanged - but produce a warning + - Repeated commas and fat commas on different lines remain unchanged but + produce a warning (to avoid promoting a side-comment to block comment) - The combination '=>,' produces a warning but is not changed (it is - likely a serious error but only its author would know how to fix it). - These warnings are only output if the --warnings flag is set. - The -drc option is off by default; this could change in the future. + likely an error but only its author would know how to fix it). + These warnings are only output if the --warning-output, -w flag is set. + + This is now the DEFAULT Behavior. + To avoid this change, use --nodelete-repeated-commas, or -ndrc. - Added control --delete-interbracket-arrows, or -dia, to delete optional hash ref and array ref arrows between brackets as in the following diff --git a/bin/perltidy b/bin/perltidy index 9048ee4e..cc44d3e9 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -3731,8 +3731,8 @@ likely an error but only its author would know how to fix it). =item * -Note that the special combination ',=>' ('winking fat comma') is ignored -by this parameter. +Note that the remaining combination ',=>' (sometimes called a +'winking fat comma') is ignored by this parameter. =item * @@ -3740,7 +3740,7 @@ These warnings are only output if the B<-w> flag is set. =back -This feature is currently off by default and must be requested. +This feature is on by default. Use B<-ndrc> to turn it off. =item B<--want-trailing-commas=s> or B<-wtc=s>, B<--add-trailing-commas> or B<-atc>, and B<--delete-trailing-commas> or B<-dtc> diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 5d0f5624..b8abb0a0 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -3833,6 +3833,7 @@ sub generate_options { noextended-continuation-indentation cuddled-break-option=1 delete-old-newlines + delete-repeated-commas delete-semicolons dump-block-minimum-lines=20 dump-block-types=sub diff --git a/t/snippets/drc.par b/t/snippets/drc.par index 56912205..4b7a0613 100644 --- a/t/snippets/drc.par +++ b/t/snippets/drc.par @@ -1 +1 @@ --drc +-ndrc diff --git a/t/snippets/expect/drc.def b/t/snippets/expect/drc.def index 5c8897dc..f47324b0 100644 --- a/t/snippets/expect/drc.def +++ b/t/snippets/expect/drc.def @@ -1 +1 @@ -ignoreSpec( $file, "file",, \%spec,,, \%Rspec ); +ignoreSpec( $file, "file", \%spec, \%Rspec ); diff --git a/t/snippets/expect/drc.drc b/t/snippets/expect/drc.drc index f47324b0..5c8897dc 100644 --- a/t/snippets/expect/drc.drc +++ b/t/snippets/expect/drc.drc @@ -1 +1 @@ -ignoreSpec( $file, "file", \%spec, \%Rspec ); +ignoreSpec( $file, "file",, \%spec,,, \%Rspec ); diff --git a/t/snippets26.t b/t/snippets26.t index e4351228..cb1bb495 100644 --- a/t/snippets26.t +++ b/t/snippets26.t @@ -46,7 +46,7 @@ BEGIN { --code-skipping-end='#>>V' ---------- 'def' => "", - 'drc' => "-drc", + 'drc' => "-ndrc", 'git106' => "-xlp -gnu -xci", 'git108' => "-wn -wfc", 'git93' => <<'----------', @@ -632,7 +632,7 @@ $r = $c-> source => "drc", params => "def", expect => <<'#9...........', -ignoreSpec( $file, "file",, \%spec,,, \%Rspec ); +ignoreSpec( $file, "file", \%spec, \%Rspec ); #9........... }, @@ -640,7 +640,7 @@ ignoreSpec( $file, "file",, \%spec,,, \%Rspec ); source => "drc", params => "drc", expect => <<'#10...........', -ignoreSpec( $file, "file", \%spec, \%Rspec ); +ignoreSpec( $file, "file",, \%spec,,, \%Rspec ); #10........... },