]> git.donarmstrong.com Git - perltidy.git/commitdiff
change dv to duv, wv to wvt=s
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 13 Dec 2023 16:34:17 +0000 (08:34 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 13 Dec 2023 16:34:17 +0000 (08:34 -0800)
The old names were a little confusing because they were very similar but
one took an arg and the other did not.
  dump-variables     -> dump-unusual-variables  (dv->duv)
  warn-variables=s   -> warn-variable-types     (wv->wvt)

CHANGES.md
bin/perltidy
lib/Perl/Tidy.pm
lib/Perl/Tidy/Formatter.pm

index 8375c847dbb6024b73c979b3abf6b3a525dd6c96..7c0803c7ddd5d04a6a7f849e410aecf33634370d 100644 (file)
@@ -2,10 +2,10 @@
 
 ## 2023 09 12.06
 
-    - Added --dump-variables (-dv) option to dump a list of variables with
-      certain properties of interest. For example
+    - Added --dump-unusual-variables (-duv) option to dump a list of
+      variables with certain properties of interest. For example
 
-         perltidy -dv somefile.pl >vars.txt
+         perltidy -duv somefile.pl >vars.txt
 
       produces a file with lines which look something like
 
         p: lexical variable with scope in multiple packages
         u: unused variable
 
-    - Added a related flag --warn-variables=s (-wv=s) option to warn
-      if certain types of variables are found in a script. For example
+    - Added a related flag --warn-variable-types=string (-wvt=string) option
+      to warn if certain types of variables are found in a script. The types
+      may include 'r', 's', and 'p' but not 'u'.
 
-        perltidy -wv=rps somefile.pl
+        perltidy -wvt=rp somefile.pl
 
-      will check for and warn if any of the above types r, s, or p are seen.
+      will check for and warn if any variabls of type 'r', or 'p' are seen.
       The manual has further details.
 
     - All parameters taking integer values are now checked for
index 89603dd6a27b9615262ac484d48170eeb4acb46e..3710b4951e9865f3488547d81f72d2b4d2a867cd 100755 (executable)
@@ -125,7 +125,7 @@ the start of every line.
 This will dump a table of comma-separated metrics for subroutines longer than
 10 lines to F<blocks.csv>.
 
-    perltidy -dv somefile.pl >vars.txt
+    perltidy -duv somefile.pl >vars.txt
 
 This will dump a list of unused and reused lexical variable names to
 F<vars.txt>.
@@ -5508,15 +5508,15 @@ This selects every if-chain which contains 2 or more B<elsif> blocks:
 
 =back
 
-=item B<Finding unused, reused, and other variables of interest with --dump-variables>
+=item B<Finding unused, reused, and other variables of interest with --dump-unusual-variables>
 
 Lexical variables with certain properties of interest to a programmer can be
-listed with B<--dump-variables> or B<-dv>.  This parameter must be on the
-command line, along with a single file name.  It causes perltidy to scan the
-file for certain variable types, write any found to the standard output, and
-then immediately exit without doing any formatting. For example
+listed with B<--dump-unusual-variables> or B<-duv>.  This parameter must be on
+the command line, along with a single file name.  It causes perltidy to scan
+the file for certain variable types, write any found to the standard output,
+and then immediately exit without doing any formatting. For example
 
-    perltidy -dv somefile.pl >vars.txt
+    perltidy -duv somefile.pl >vars.txt
 
 produces a file with lines which look something like
 
@@ -5564,19 +5564,19 @@ provided by another routine or data structure but which are not needed, or they
 might be defined for possible future program development, clarity or debugging.
 But sometimes they can occur due to being orphaned by a coding change, due to a
 misspelling, or by having an unintentional preceding C<my>.  So it is worth
-checking them, especially for new code.
+reviewing them, especially for new code.
 
 =back
 
-=item B<Warning about certain variables type with --warn-variables>
+=item B<Warning about certain variable types with --warn-variable-types>
 
-The flag B<--warn-variables=string>, or B<-wv=string>, can be used to to
+The flag B<--warn-variable-types=string>, or B<-wvt=string>, can be used to to
 produce a warning message if certain of the above variable types are
 encountered during formatting.   The input parameter B<string> is a
 a concatenation of the letters associated with the types of variables
-to produce a warning. For example:
+which are to produce a warning. For example:
 
-   perltidy -wv=sp somefile.pl
+   perltidy -wvt=sp somefile.pl
 
 will process F<somefile.pl> normally but issue a warning if either of
 the issues 's' or 'p', described above, are encountered.
@@ -5586,10 +5586,10 @@ A limitation is that warnings may not be requested for unused variables, type
 when perltidy is run on small snippets of code from within an editor.
 
 All possible variable warnings may be requested with B<-wv=rsp> or simply
-B<-wv=1> or B<-wv='*'>.  The default is not to do these checks, and it can
-also be indicated with B<-wv=0>.
+B<-wvt=1> or B<-wvt='*'>.  The default is not to do these checks, and it can
+also be indicated with B<-wvt=0>.
 
-A companion flag, B<--want-variables-exclusion-list=string>, or B<-wvxl=string>,
+A companion flag, B<--warn-variable-exclusion-list=string>, or B<-wvxl=string>,
 can be used to skip warning checks for a list of variables.  For example,
 
    perltidy -wv=1 -wvxl='$self $class'  somefile.pl
index 793856a5af723cf09586f67dd2405369436d47c2..435fa21f083f6730d5f6451a9fcacd496abcf4ad 100644 (file)
@@ -915,7 +915,7 @@ EOM
     # line parameters and is expecting formatted output to stdout.  Another
     # precaution, added elsewhere, is to ignore these in a .perltidyrc
     my $num_files = @Arg_files;
-    foreach my $opt_name (qw(dump-block-summary dump-variables)) {
+    foreach my $opt_name (qw(dump-block-summary dump-unusual-variables)) {
         if ( $rOpts->{$opt_name} && $num_files != 1 ) {
             Die(<<EOM);
 --$opt_name expects 1 filename in the arg list but saw $num_files filenames
@@ -3635,22 +3635,22 @@ sub generate_options {
     ########################################
     $category = 9;    # Other controls
     ########################################
-    $add_option->( 'warn-missing-else',             'wme',  '!' );
-    $add_option->( 'add-missing-else',              'ame',  '!' );
-    $add_option->( 'add-missing-else-comment',      'amec', '=s' );
-    $add_option->( 'delete-block-comments',         'dbc',  '!' );
-    $add_option->( 'delete-closing-side-comments',  'dcsc', '!' );
-    $add_option->( 'delete-pod',                    'dp',   '!' );
-    $add_option->( 'delete-side-comments',          'dsc',  '!' );
-    $add_option->( 'tee-block-comments',            'tbc',  '!' );
-    $add_option->( 'tee-pod',                       'tp',   '!' );
-    $add_option->( 'tee-side-comments',             'tsc',  '!' );
-    $add_option->( 'look-for-autoloader',           'lal',  '!' );
-    $add_option->( 'look-for-hash-bang',            'x',    '!' );
-    $add_option->( 'look-for-selfloader',           'lsl',  '!' );
-    $add_option->( 'pass-version-line',             'pvl',  '!' );
-    $add_option->( 'warn-variables',                'wv',   '=s' );
-    $add_option->( 'warn-variables-exclusion-list', 'wvxl', '=s' );
+    $add_option->( 'warn-missing-else',            'wme',  '!' );
+    $add_option->( 'add-missing-else',             'ame',  '!' );
+    $add_option->( 'add-missing-else-comment',     'amec', '=s' );
+    $add_option->( 'delete-block-comments',        'dbc',  '!' );
+    $add_option->( 'delete-closing-side-comments', 'dcsc', '!' );
+    $add_option->( 'delete-pod',                   'dp',   '!' );
+    $add_option->( 'delete-side-comments',         'dsc',  '!' );
+    $add_option->( 'tee-block-comments',           'tbc',  '!' );
+    $add_option->( 'tee-pod',                      'tp',   '!' );
+    $add_option->( 'tee-side-comments',            'tsc',  '!' );
+    $add_option->( 'look-for-autoloader',          'lal',  '!' );
+    $add_option->( 'look-for-hash-bang',           'x',    '!' );
+    $add_option->( 'look-for-selfloader',          'lsl',  '!' );
+    $add_option->( 'pass-version-line',            'pvl',  '!' );
+    $add_option->( 'warn-variable-types',          'wvt',  '=s' );
+    $add_option->( 'warn-variable-exclusion-list', 'wvxl', '=s' );
 
     ########################################
     $category = 13;    # Debugging
@@ -3667,7 +3667,7 @@ sub generate_options {
     $add_option->( 'dump-profile',                    'dpro',  '!' );
     $add_option->( 'dump-short-names',                'dsn',   '!' );
     $add_option->( 'dump-token-types',                'dtt',   '!' );
-    $add_option->( 'dump-variables',                  'dv',    '!' );
+    $add_option->( 'dump-unusual-variables',          'duv',   '!' );
     $add_option->( 'dump-want-left-space',            'dwls',  '!' );
     $add_option->( 'dump-want-right-space',           'dwrs',  '!' );
     $add_option->( 'experimental',                    'exp',   '=s' );
@@ -4551,7 +4551,7 @@ EOM
                     dump-want-left-space
                     dump-want-right-space
                     dump-block-summary
-                    dump-variables
+                    dump-unusual-variables
                     help
                     stylesheet
                     version
index 4a39bb883e4ad8a0321f978b134d59ce49499b0e..5c69031c63dd88039d726542981b282985a9d7b0 100644 (file)
@@ -6413,15 +6413,15 @@ EOM
     }
 
     # Dump variable usage info if requested
-    if ( $rOpts->{'dump-variables'} ) {
-        $self->dump_variables();
+    if ( $rOpts->{'dump-unusual-variables'} ) {
+        $self->dump_unusual_variables();
         Exit(0);
     }
 
-    # Act on -warn-variables if requesed and if the logger is available
+    # Act on -warn-variable-types if requesed and if the logger is available
     # (the logger is deactivated during iterations)
-    $self->warn_variables()
-      if ( $rOpts->{'warn-variables'}
+    $self->warn_variable_types()
+      if ( $rOpts->{'warn-variable-types'}
         && $self->[_logger_object_] );
 
     $self->examine_vertical_tightness_flags();
@@ -9401,10 +9401,10 @@ EOM
     return \@sorted;
 } ## end sub scan_variable_usage
 
-sub dump_variables {
+sub dump_unusual_variables {
     my ($self) = @_;
 
-    # process a --dump-variables(-dv) command
+    # process a --dump-unusual-variables(-duv) command
 
     my $rlines = $self->scan_variable_usage();
     return unless ( @{$rlines} );
@@ -9426,18 +9426,18 @@ EOM
     print {*STDOUT} $output_string;
 
     return;
-} ## end sub dump_variables
+} ## end sub dump_unusual_variables
 
-sub warn_variables {
+sub warn_variable_types {
     my ($self) = @_;
 
-    # process a --warn-variables command
+    # process a --warn-variable-types command
 
-    my $wv_key    = 'warn-variables';
+    my $wv_key    = 'warn-variable-types';
     my $wv_option = $rOpts->{$wv_key};
 
     # Single letter options:
-    #  u - declared but unused [NOT AVAILABLE here, use --dump-variables]
+    #  u - declared but unused [NOT AVAILABLE, use --dump-unusual-variables]
     #  r - reused scope
     #  s - reused sigil
     #  p - package boundaries crossed by lexical variables
@@ -9445,7 +9445,7 @@ sub warn_variables {
     #  1 - all of the above
     #  * - all of the above
     # Example:
-    #  -wv=sr  : do check types 's' and 'r'
+    #  -wvt=sr  : do check types 's' and 'r'
 
     if ( $wv_option eq '*' || $wv_option eq '1' ) { $wv_option = 'spr' }
 
@@ -9453,7 +9453,7 @@ sub warn_variables {
     # needless warnings when perltidy is run on small blocks from an editor.
     if ( $wv_option =~ s/u//g ) {
         Warn(<<EOM);
---$wv_key=u is not available; use --dump-variables=u to find unused vars
+--$wv_key=u is not available; use --dump-unusual-variables=u to find unused vars
 EOM
     }
 
@@ -9469,7 +9469,7 @@ Line:Issue: Var: note
 EOM
 
     # remove any excluded names
-    my $wvxl_key       = 'warn-variables-exclusion-list';
+    my $wvxl_key       = 'warn-variable-exclusion-list';
     my $excluded_names = $rOpts->{$wvxl_key};
     my %is_excluded_name;
     if ($excluded_names) {
@@ -9493,7 +9493,7 @@ EOM
     $message .= "End scan for --$wv_key=$wv_option:\n";
     warning($message);
     return;
-} ## end sub warn_variables
+} ## end sub warn_variable_types
 
 sub find_non_indenting_braces {