From: Steve Hancock Date: Thu, 29 Oct 2020 13:48:01 +0000 (-0700) Subject: update documentation and comments X-Git-Tag: 20201001.03~27 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b4d63d117fde11d7a5d993fbd5f31cc6d265262e;p=perltidy.git update documentation and comments --- diff --git a/CHANGES.md b/CHANGES.md index f7611bc5..e0295e42 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ ## 2020 10 01.02 + - Fix git #44, fix exit status for assert-tidy/untidy. The exit status was + always 0 for --assert-tidy if the user had turned off all error messages with + the -quiet. This has been fixed. + - Add flag -mfs=n, --maximum-file-size-mb=n. This parameter is provided to avoid causing system problems by accidentally attempting to format an extremely large data file. The default is n=10. The command to increase diff --git a/bin/perltidy b/bin/perltidy index 161c22fb..aa2f1973 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -284,8 +284,7 @@ B<--nowarning-output>, is not to include these warnings. =item B<-q>, B<--quiet> -Deactivate error messages and syntax checking (for running under -an editor). +Deactivate error messages (for running under an editor). For example, if you use a vi-style editor, such as vim, you may execute perltidy as a filter from within the editor using something like @@ -368,6 +367,8 @@ This error message will cause the process to return a non-zero exit code. The test for this is made by comparing an MD5 hash value for the input and output code streams. This flag has no other effect on the functioning of perltidy. This might be useful for certain code maintenance operations. +Note: you will not see this message if you have error messages turned off with the +-quiet flag. =item B<-asu>, B<--assert-untidy> diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index adc88594..45f11178 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -1528,7 +1528,7 @@ EOM $logger_object->interrupt_logfile(); $logger_object->warning( $diff_msg . "\n" ); $logger_object->resume_logfile(); - $Warn_count++; + $Warn_count++; # insure correct exit if -q flag is set } } if ( $rOpts->{'assert-untidy'} ) { @@ -1537,7 +1537,7 @@ EOM $logger_object->warning( "assertion failure: '--assert-untidy' is set but output equals input\n" ); - $Warn_count++; + $Warn_count++; # insure correct exit if -q flag is set } } diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 60cd771d..2fd90f47 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -3205,7 +3205,7 @@ EOM if ( $next_nonblank_token eq '(' ) { # For something like: - # : prototype($$) + # : prototype($$) # we should let do_scan_sub see it so that it can see # the prototype. All other attributes get parsed as a # quoted string. @@ -3226,14 +3226,14 @@ EOM max_token_index => $max_token_index ); - # If successful, mark as type 'q' to be consistent with other - # attributes. Note that type 'w' would also work. + # If successful, mark as type 'q' to be consistent with other + # attributes. Note that type 'w' would also work. if ( $i > $i_beg ) { - $type = 'q'; + $type = 'q'; next; } - # If not successful, fall through and parse as a quote. + # If not successful, continue and parse as a quote. } # All other attribute lists must be parsed as quotes @@ -6739,6 +6739,7 @@ sub scan_identifier_do { sub initialize_subname { $package_saved = ""; $subname_saved = ""; + return; } use constant { @@ -6801,7 +6802,7 @@ sub scan_identifier_do { my $id_scan_state = $input_hash{id_scan_state}; my $max_token_index = $input_hash{max_token_index}; - # Determine the CALL TYPE + # Determine the CALL TYPE # 1=sub # 2=( # 3=prototype @@ -6874,9 +6875,9 @@ sub scan_identifier_do { $proto = $1; $attrs = $2; - # Append the prototype to the starting token if it is 'sub' or - # 'prototype'. This is not necessary but for compatibility with previous - # versions when the -csc flag is used: + # Append the prototype to the starting token if it is 'sub' or + # 'prototype'. This is not necessary but for compatibility with previous + # versions when the -csc flag is used: if ( $proto && ( $match || $call_type == PROTOTYPE_CALL ) ) { $tok .= $proto; } diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index b4e451c4..ff3f8dd0 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,11 @@ =over 4 +=item b + +The exit status was always 0 for --assert-tidy if the user had turned off error +messages with -quiet. This has been fixed. + =item b A parsing error was encountered in a test parsing the following extruded