## 2024 02 02.01
+ - The option --delete-repeated-commas, -drc has been expanded as follows:
+ - 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
+ - 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.
+
- Added control --delete-interbracket-arrows, or -dia, to delete optional
hash ref and array ref arrows between brackets as in the following
expression (see git #131)
# perltidy -drc:
ignoreSpec( $file, "file", \%spec, \%Rspec );
-Since the default is not to add or delete commas, this feature is off by default and must be requested.
+This parameter also deletes repeated fat commas, '=>'. The complete list of
+actions taken when this flag is set are as follows:
+=over 4
+
+=item *
+
+Repeated commas like ',,' on the same line are removed with a warning.
+
+=item *
+Repeated fat commas like '=> =>' on the same line are removed with a warning.
+
+=item *
+
+Repeated commas and fat commas on different lines remain unchanged
+but produce a warning.
+
+=item *
+
+The combination '=>,' produces a warning but is not changed (it is
+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.
+
+=item *
+
+These warnings are only output if the B<--warnings> flag is set.
+
+=back
+
+This feature is currently off by default and must be requested.
=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>
# do not delete a comma repeated on a different line -
# this can cause problems, such as promoting a side comment
# to a block comment. See test 'mangle4.in'
+ my $lno = 1 + $rLL->[$KK]->[_LINE_INDEX_];
if ( $KK == $Kfirst ) {
- ## but a warning could be issued
+ complain(
+ "repeated commas across multiple lines, not deleted\n",
+ $lno
+ );
}
else {
# Could note this deletion as a possible future update:
## $self->note_deleted_comma($input_line_number);
+ complain( "deleted repeated ','\n", $lno );
next;
}
}
+ elsif ($last_nonblank_code_type eq '=>'
+ && $rOpts->{'delete-repeated-commas'} )
+ {
+ my $lno = 1 + $rLL->[$KK]->[_LINE_INDEX_];
+ complain( "found '=>,' ... error?\n", $lno );
+ }
# remember input line index of first comma if -wtc is used
if (%trailing_comma_rules) {
}
}
}
+ elsif ( $type eq '=>' ) {
+ if ( $last_nonblank_code_type eq '=>'
+ && $rOpts->{'delete-repeated-commas'} )
+ {
+
+ # Check for repeated '=>'s
+ # Note that ',=>' is useful and called a winking fat comma
+
+ # Do not delete a fat comma repeated on a different line -
+ # this can cause problems, such as promoting a side comment
+ # to a block comment. See test 'mangle4.in'
+ my $lno = 1 + $rLL->[$KK]->[_LINE_INDEX_];
+ if ( $KK == $Kfirst ) {
+ complain(
+ "-repeated '=>' acriss multiple lines, not deleted\n",
+ $lno );
+ }
+ else {
+ complain( "deleted repeated '=>'\n", $lno );
+ next;
+ }
+ }
+ }
# change 'LABEL :' to 'LABEL:'
elsif ( $type eq 'J' ) {