-# perlcritic is a great tool for locating potentially 'dodgy' coding.
+# perlcritic is a good tool for locating potentially 'dodgy' coding.
# Some useful links:
# https://manpages.ubuntu.com/manpages/xenial/man1/perlcritic.1p.html
# perlcritic --single-policy Subroutines::ProhibitSubroutinePrototypes Module.pm
# Below is a list of policies that are skipped or customized to the needs of
-# Perl::Tidy. After experimenting with ## no critic comments, I decided that
-# they cause more trouble than the value they provide, so policies are either
-# 'on' or 'off'.
+# Perl::Tidy. I have found that using 'no critic' comments is very
+# troublesome*, so policies are either 'on' or 'off' for all modules.
+# ( *For example, why is it necessary to specify a policy in a side comment?
+# The very long policy names are ugly and typically make the side comment
+# exceed the desired line length. )
#--------------------------------------------------------------
# Following is a list of policies to be skipped for severity=4:
# any benefit in reduced run time or clarity.
[-ControlStructures::ProhibitCascadingIfElse]
-# Agree - these are in process of being converted to if's
+# This is a reasonable policy for new code but it is not worth changing
+# debugged code for it.
[-ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions]
# This is a good general policy but not always the best for efficiency
# Perltidy Change Log
+## 2022 xx xx
+
+ - Added parameter --delete-repeated-commas (-drc) to delete repeated
+ commas. This is off by default. For example, given this line:
+
+ ignoreSpec( $file, "file",, \%spec, \%Rspec );
+
+ # perltidy -drc:
+ ignoreSpec( $file, "file", \%spec, \%Rspec );
+
## 2022 06 13
- No significant bugs have been found since the last release but users
$add_option->( 'block-brace-tightness', 'bbt', '=i' );
$add_option->( 'brace-tightness', 'bt', '=i' );
$add_option->( 'delete-old-whitespace', 'dws', '!' );
+ $add_option->( 'delete-repeated-commas', 'drc', '!' );
$add_option->( 'delete-semicolons', 'dsm', '!' );
$add_option->( 'function-paren-vertical-alignment', 'fpva', '!' );
$add_option->( 'keyword-paren-inner-tightness', 'kpit', '=i' );
next;
} ## end if ( $type eq 'q' )
+ # delete repeated commas if requested
+ elsif ( $type eq ',' ) {
+ if ( $last_nonblank_code_type eq ','
+ && $rOpts->{'delete-repeated-commas'} )
+ {
+ # Could note this deletion as a possible future update:
+ ## $self->note_deleted_comma($input_line_number);
+ next;
+ }
+ }
+
# change 'LABEL :' to 'LABEL:'
elsif ( $type eq 'J' ) {
$token =~ s/\s+//g;