From 15ca210120867194b6d8b8ccaa010d394e2bce74 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 19 Mar 2023 19:37:26 -0700 Subject: [PATCH] remove unused DIAGNOSTICS parameter, fix comments --- dev-bin/build.pl | 6 +-- lib/Perl/Tidy.pm | 58 ++++++++++++++--------------- t/snippets/dump_negated_switches.pl | 5 ++- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/dev-bin/build.pl b/dev-bin/build.pl index a120a8d0..b3e6829e 100755 --- a/dev-bin/build.pl +++ b/dev-bin/build.pl @@ -754,10 +754,10 @@ sub update_VERSION { my $is_pod_file = !$is_md_file && $source_file !~ /\.pm/; while ( my $line = <$fh> ) { - # Look for and turn off any DEVEL_MODE, DEBUG_XXX, VERIFY_XXX, TEST_XXX, - # and EXPLAIN_XXX constants + # Look for and turn off any of the form: + # DEVEL_MODE, DIAGNOSTICS, DEBUG_XXX, VERIFY_XXX, TEST_XXX, EXPLAIN_XXX if ( $line =~ -/^(\s*use\s+constant\s+(?:DEBUG|DEVEL|EXPLAIN|VERIFY|TEST)_[A-Z]+\s*)=>\s*(-?\d*);(.*)$/ +/^(\s*use\s+constant\s+(?:DEBUG|DEVEL|DIAGNOSTICS|EXPLAIN|VERIFY|TEST)_[A-Z]+\s*)=>\s*(-?\d*);(.*)$/ ) { if ( $2 != 0 ) { diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index d5c345c4..c729f99c 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -82,6 +82,7 @@ local $OUTPUT_AUTOFLUSH = 1; # DEVEL_MODE can be turned on for extra checking during development use constant DEVEL_MODE => 0; +use constant DIAGNOSTICS => 0; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; @@ -916,7 +917,7 @@ EOM # Create a diagnostics object if requested; # This is only useful for code development my $diagnostics_object = undef; - if ( $rOpts->{'DIAGNOSTICS'} ) { + if (DIAGNOSTICS) { $diagnostics_object = Perl::Tidy::Diagnostics->new(); } @@ -3008,19 +3009,17 @@ sub generate_options { # %option_range - a hash giving the valid ranges of certain options # Note: a few options are not documented in the man page and usage - # message. This is because these are experimental or debug options and - # may or may not be retained in future versions. + # message. This is because these are depricated, experimental or debug + # options and may or may not be retained in future versions: + + # These undocumented flags are accepted but not used: + # --check-syntax + # --fuzzy-line-length # - # Here are the undocumented flags as far as I know. Any of them - # may disappear at any time. They are mainly for fine-tuning - # and debugging. + # These undocumented flags are for debugging: + # --recombine # used to debug line breaks + # --short-concatenation-item-length # used to break a '.' chain # - # fll --> fuzzy-line-length # a trivial parameter which gets - # turned off for the extrude option - # which is mainly for debugging - # scl --> short-concatenation-item-length # helps break at '.' - # recombine # for debugging line breaks - # I --> DIAGNOSTICS # for debugging [**DEACTIVATED**] ###################################################################### # here is a summary of the Getopt codes: @@ -3391,22 +3390,21 @@ sub generate_options { ######################################## $category = 13; # Debugging ######################################## - $add_option->( 'DIAGNOSTICS', 'I', '!' ) if (DEVEL_MODE); - $add_option->( 'DEBUG', 'D', '!' ); - $add_option->( 'dump-block-summary', 'dbs', '!' ); - $add_option->( 'dump-block-minimum-lines', 'dbl', '=i' ); - $add_option->( 'dump-block-types', 'dbt', '=s' ); - $add_option->( 'dump-cuddled-block-list', 'dcbl', '!' ); - $add_option->( 'dump-defaults', 'ddf', '!' ); - $add_option->( 'dump-long-names', 'dln', '!' ); - $add_option->( 'dump-options', 'dop', '!' ); - $add_option->( 'dump-profile', 'dpro', '!' ); - $add_option->( 'dump-short-names', 'dsn', '!' ); - $add_option->( 'dump-token-types', 'dtt', '!' ); - $add_option->( 'dump-want-left-space', 'dwls', '!' ); - $add_option->( 'dump-want-right-space', 'dwrs', '!' ); - $add_option->( 'fuzzy-line-length', 'fll', '!' ); - $add_option->( 'help', 'h', EMPTY_STRING ); + $add_option->( 'DEBUG', 'D', '!' ); + $add_option->( 'dump-block-summary', 'dbs', '!' ); + $add_option->( 'dump-block-minimum-lines', 'dbl', '=i' ); + $add_option->( 'dump-block-types', 'dbt', '=s' ); + $add_option->( 'dump-cuddled-block-list', 'dcbl', '!' ); + $add_option->( 'dump-defaults', 'ddf', '!' ); + $add_option->( 'dump-long-names', 'dln', '!' ); + $add_option->( 'dump-options', 'dop', '!' ); + $add_option->( 'dump-profile', 'dpro', '!' ); + $add_option->( 'dump-short-names', 'dsn', '!' ); + $add_option->( 'dump-token-types', 'dtt', '!' ); + $add_option->( 'dump-want-left-space', 'dwls', '!' ); + $add_option->( 'dump-want-right-space', 'dwrs', '!' ); + $add_option->( 'fuzzy-line-length', 'fll', '!' ); + $add_option->( 'help', 'h', EMPTY_STRING ); $add_option->( 'short-concatenation-item-length', 'scl', '=i' ); $add_option->( 'show-options', 'opt', '!' ); $add_option->( 'timestamp', 'ts', '!' ); @@ -4443,7 +4441,9 @@ EOM make_grep_alias_string($rOpts); # Turn on fuzzy-line-length unless this is an extrude run, as determined - # by the -i and -ci settings. Otherwise blinkers can form (case b935) + # by the -i and -ci settings. Otherwise blinkers can form (case b935). + # This is an undocumented parameter used only for stress-testing when + # --extrude is set. if ( !$rOpts->{'fuzzy-line-length'} ) { if ( $rOpts->{'maximum-line-length'} != 1 || $rOpts->{'continuation-indentation'} != 0 ) diff --git a/t/snippets/dump_negated_switches.pl b/t/snippets/dump_negated_switches.pl index 0cd8cc38..705df3bf 100755 --- a/t/snippets/dump_negated_switches.pl +++ b/t/snippets/dump_negated_switches.pl @@ -31,9 +31,12 @@ foreach my $short_name ( @{$rshort_names} ) { } } -# delete these: -check-syntax or -syn is accepted but no longer does anything +# delete these: +# -check-syntax or -syn is accepted but no longer does anything +# -fuzzy-line-length or -fll is accepted but no longer does anything my @skip = qw( check-syntax + fuzzy-line-length ); foreach (@skip) { if ( $abbrev{$_} ) { delete $abbrev{$_} } -- 2.39.5