From: Steve Hancock Date: Sat, 14 Sep 2019 04:13:09 +0000 (-0700) Subject: version change to 20190915 X-Git-Tag: 20190915~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bbbc7926c1da8afe7f94aeddb7a7e49e00cf5509;p=perltidy.git version change to 20190915 --- diff --git a/CHANGES.md b/CHANGES.md index ee2c2b92..dc4d4d09 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Perltidy Change Log -## 2019 06 01.01 +## 2019 09 15 - implement issue RT#130425: check mode. A new flag '--assert-tidy' will cause an error message if the output script is not identical to @@ -15,11 +15,13 @@ for "use lib". - fixed issue RT#130304: standard error output should include filename. - When perltidy error messages are directed to the standard error output with - -se or --standard-error-output, the message lines now have a prefix with - 'filename:' for clarification when multiple files are processed. If an - input filename is not known, for example when input is from the standard - input or a data structure, then displayed filename is 'perltidy'. + When perltidy error messages are directed to the standard error output + with -se or --standard-error-output, the message lines now have a prefix + 'filename:' for clarification in case multiple files + are processed, where 'filename' is the name of the input file. If + input is from the standard input the displayed filename is '', + and if it is from a data structure then displayed filename + is ''. - fixed issue RT#130297; the perltidy script now exits with a nonzero exit status if it wrote to the standard error output. Prevously only fatal @@ -28,8 +30,8 @@ flag now has these values: 0 = no errors - 1 = fatal error - 2 = non-fatal error + 1 = perltidy could not run to completion due to errors + 2 = perltidy ran to completion with error messages - added warning message for RT#130008, which warns of conflicting input parameters -iob and -bom or -boc. @@ -40,7 +42,7 @@ my @addunix = map { File::Spec::Unix->catfile( @ROOT, @$_ ) } ['b']; Formerly, any space was removed. Now it is optional, and the output will - follow the input. + follow the input. - fixed issue git#13, needless trailing whitespace in error message diff --git a/bin/perltidy b/bin/perltidy index d1580670..5617bcd5 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -14,9 +14,9 @@ if ( $^O =~ /Mac/ ) { } # Exit codes returned by perltidy: -# 0 - successful run without errors -# 1 - run terminated with a fatal error -# 2 - successful run but with non-fatal warning messages +# 0 = no errors +# 1 = perltidy could not run to completion due to errors +# 2 = perltidy ran to completion with error messages exit Perl::Tidy::perltidy( argv => $arg_string ); __END__ @@ -364,6 +364,7 @@ as non-text, and this flag forces perltidy to process them. This flag asserts that the input and output code streams are identical, or in other words that the input code is already 'tidy' according to the formatting parameters. If this is not the case, an error message noting this is produced. +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. @@ -3750,13 +3751,29 @@ F. =back +=head1 ERROR HANDLING + +An exit value of 0, 1, or 2 is returned by perltidy to indicate the status of the result. + +A exit value of 0 indicates that perltidy ran to completion with no error messages. + +An exit value of 1 indicates that the process had to be terminated early due to +errors in the input parameters. This can happen for example if a parameter is +misspelled or given an invalid value. Error messages in the standard +error output will indicate the cause of any problem. + +An exit value of 2 indicates that perltidy ran to completion but there there +are warning messages in the standard error output related to parameter errors or +conflicts and/or warning messages in the perltidy error file(s) relating to +possible syntax errors in the source code being tidied. + =head1 SEE ALSO perlstyle(1), Perl::Tidy(3) =head1 VERSION -This man page documents perltidy version 20190601.01 +This man page documents perltidy version 20190915 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index 77005926..b1093224 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,5 +1,58 @@

Perltidy Change Log

+

2019 09 15

+ +
- implement issue RT#130425: check mode.  A new flag '--assert-tidy'
+  will cause an error message if the output script is not identical to
+  the input script. For completeness, the opposite flag '--assert-untidy'
+  has also been added.
+
+- iteration speedup for unchanged code.  Previously, when iterations were
+  requested, at least two formatting passes were made. Now just a single pass
+  is made if the formatted code is identical to the input code.
+
+- fixed issue RT#130344: false warning "operator in print statement" 
+  for "use lib". 
+
+- fixed issue RT#130304: standard error output should include filename.
+  When perltidy error messages are directed to the standard error output 
+  with -se or --standard-error-output, the message lines now have a prefix 
+  'filename:' for clarification in case multiple files 
+  are processed, where 'filename' is the name of the input file.  If 
+  input is from the standard input the displayed filename is '<stdin>', 
+  and if it is from a data structure then displayed filename 
+  is '<source_stream>'.
+
+- fixed issue RT#130297; the perltidy script now exits with a nonzero exit 
+  status if it wrote to the standard error output. Prevously only fatal
+  run errors produced a non-zero exit flag. Now, even non-fatal messages
+  requested with the -w flag will cause a non-zero exit flag.  The exit
+  flag now has these values:
+
+     0 = no errors
+     1 = perltidy could not run to completion due to errors
+     2 = perltidy ran to completion with error messages
+
+- added warning message for RT#130008, which warns of conflicting input
+  parameters -iob and -bom or -boc.
+
+- fixed RT#129850; concerning a space between a closing block brace and
+  opening bracket or brace, as occurs before the '[' in this line:
+
+   my @addunix = map { File::Spec::Unix->catfile( @ROOT, @$_ ) } ['b'];
+
+  Formerly, any space was removed. Now it is optional, and the output will
+  follow the input.
+
+- fixed issue git#13, needless trailing whitespace in error message
+
+- fixed issue git#9: if the -ce (--cuddled-else) flag is used,
+  do not try to form new one line blocks for a block type 
+  specified with -cbl, particularly map, sort, grep
+
+- some improved vertical alignments
+
+

2019 06 01

- rt #128477: Prevent inconsistent owner/group and setuid/setgid bits. 
@@ -468,7 +521,7 @@ NEW:
 
  - Fixed RT #107832 and #106492, lack of vertical alignment of two lines
    when -boc flag (break at old commas) is set.  This bug was 
-   inadvertently introduced in previous bug fix RT #98902.
+   inadvertently introduced in previous bug fix RT #98902. 
 
  - Some common extensions to Perl syntax are handled better.
    In particular, the following snippet is now foratted cleanly:
diff --git a/docs/Tidy.html b/docs/Tidy.html
index 2d3a162a..d77229bc 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -183,9 +183,13 @@
 
 

ERROR HANDLING

-

Perltidy will return with an error flag indicating if the process had to be terminated early due to errors in the input parameters. This can happen for example if a parameter is misspelled or given an invalid value. The calling program should check this flag because if it is set the destination stream will be empty or incomplete and should be ignored. Error messages in the stderr stream will indicate the cause of any problem.

+

An exit value of 0, 1, or 2 is returned by perltidy to indicate the status of the result.

-

If the error flag is not set then perltidy ran to completion. However there may still be warning messages in the stderr stream related to control parameters, and there may be warning messages in the errorfile stream relating to possible syntax errors in the source code being tidied.

+

A exit value of 0 indicates that perltidy ran to completion with no error messages.

+ +

An exit value of 1 indicates that the process had to be terminated early due to errors in the input parameters. This can happen for example if a parameter is misspelled or given an invalid value. The calling program should check for this flag because if it is set the destination stream will be empty or incomplete and should be ignored. Error messages in the stderr stream will indicate the cause of any problem.

+ +

An exit value of 2 indicates that perltidy ran to completion but there there are warning messages in the stderr stream related to parameter errors or conflicts and/or warning messages in the errorfile stream relating to possible syntax errors in the source code being tidied.

In the event of a catastrophic error for which recovery is not possible perltidy terminates by making calls to croak or confess to help the programmer localize the problem. These should normally only occur during program development.

@@ -349,7 +353,7 @@

VERSION

-

This man page documents Perl::Tidy version 20190601

+

This man page documents Perl::Tidy version 20190915

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index abaddf00..7399b90d 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -47,6 +47,7 @@
  • SWITCHES WHICH MAY BE NEGATED
  • LIMITATIONS
  • FILES
  • +
  • ERROR HANDLING
  • SEE ALSO
  • VERSION
  • BUG REPORTS
  • @@ -304,6 +305,18 @@

    Force perltidy to process binary files. To avoid producing excessive error messages, perltidy skips files identified by the system as non-text. However, valid perl scripts containing binary data may sometimes be identified as non-text, and this flag forces perltidy to process them.

    + +
    -ast, --assert-tidy
    +
    + +

    This flag asserts that the input and output code streams are identical, or in other words that the input code is already 'tidy' according to the formatting parameters. If this is not the case, an error message noting this is produced. 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.

    + +
    +
    -asu, --assert-untidy
    +
    + +

    This flag asserts that the input and output code streams are different, or in other words that the input code is 'untidy' according to the formatting parameters. If this is not the case, an error message noting this is produced. This flag has no other effect on the functioning of perltidy.

    +
    @@ -2867,13 +2880,23 @@ +

    ERROR HANDLING

    + +

    An exit value of 0, 1, or 2 is returned by perltidy to indicate the status of the result.

    + +

    A exit value of 0 indicates that perltidy ran to completion with no error messages.

    + +

    An exit value of 1 indicates that the process had to be terminated early due to errors in the input parameters. This can happen for example if a parameter is misspelled or given an invalid value. Error messages in the standard error output will indicate the cause of any problem.

    + +

    An exit value of 2 indicates that perltidy ran to completion but there there are warning messages in the standard error output related to parameter errors or conflicts and/or warning messages in the perltidy error file(s) relating to possible syntax errors in the source code being tidied.

    +

    SEE ALSO

    perlstyle(1), Perl::Tidy(3)

    VERSION

    -

    This man page documents perltidy version 20190601

    +

    This man page documents perltidy version 20190915

    BUG REPORTS

    diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 7c3dca83..1e9cd61d 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -110,7 +110,7 @@ BEGIN { # Release version must be bumped, and it is probably past time for a # release anyway. - $VERSION = '20190601.01'; + $VERSION = '20190915'; } sub streamhandle { @@ -1475,11 +1475,10 @@ EOM # standard error output, even non-fatal warning messages, otherwise return # false. - # To allow the caller to determine the error severity, these exit codes are - # returned: - # 0 - successful run without errors - # 1 - run terminated with a fatal error - # 2 - successful run but with non-fatal warning messages + # These exit codes are returned: + # 0 = perltidy ran to completion with no errors + # 1 = perltidy could not run to completion due to errors + # 2 = perltidy ran to completion with error messages # Note that if perltidy is run with multiple files, any single file with # errors or warnings will write a line like diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 6c677bc0..41e0abf3 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -188,17 +188,21 @@ B in the perltidy distribution. =head1 ERROR HANDLING -Perltidy will return with an error flag indicating if the process had to be -terminated early due to errors in the input parameters. This can happen for -example if a parameter is misspelled or given an invalid value. The calling -program should check this flag because if it is set the destination stream will -be empty or incomplete and should be ignored. Error messages in the B -stream will indicate the cause of any problem. - -If the error flag is not set then perltidy ran to completion. However there -may still be warning messages in the B stream related to control -parameters, and there may be warning messages in the B stream -relating to possible syntax errors in the source code being tidied. +An exit value of 0, 1, or 2 is returned by perltidy to indicate the status of the result. + +A exit value of 0 indicates that perltidy ran to completion with no error messages. + +An exit value of 1 indicates that the process had to be terminated early due to +errors in the input parameters. This can happen for example if a parameter is +misspelled or given an invalid value. The calling program should check for +this flag because if it is set the destination stream will be empty or +incomplete and should be ignored. Error messages in the B stream will +indicate the cause of any problem. + +An exit value of 2 indicates that perltidy ran to completion but there there +are warning messages in the B stream related to parameter errors or +conflicts and/or warning messages in the B stream relating to +possible syntax errors in the source code being tidied. In the event of a catastrophic error for which recovery is not possible B terminates by making calls to B or B to help the @@ -410,7 +414,7 @@ C in Tidy.pm. =head1 VERSION -This man page documents Perl::Tidy version 20190601.01 +This man page documents Perl::Tidy version 20190915 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 7a5d60ee..1c271263 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -7,7 +7,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { diff --git a/lib/Perl/Tidy/DevNull.pm b/lib/Perl/Tidy/DevNull.pm index d126d3f5..1c36597c 100644 --- a/lib/Perl/Tidy/DevNull.pm +++ b/lib/Perl/Tidy/DevNull.pm @@ -7,8 +7,8 @@ package Perl::Tidy::DevNull; use strict; use warnings; -our $VERSION = '20190601.01'; -sub new { my $self = shift; return bless {}, $self } +our $VERSION = '20190915'; +sub new { my $self = shift; return bless {}, $self } sub print { return } sub close { return } diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index f8175e1b..50c6f20e 100644 --- a/lib/Perl/Tidy/Diagnostics.pm +++ b/lib/Perl/Tidy/Diagnostics.pm @@ -20,7 +20,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index 4c6ed7ff..fa033d67 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; # Maximum number of little messages; probably need not be changed. my $MAX_NAG_MESSAGES = 6; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 4da556c5..56c93676 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -12,7 +12,7 @@ package Perl::Tidy::Formatter; use strict; use warnings; use Carp; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() @@ -645,12 +645,12 @@ sub new { $gnu_position_predictor = 0; # where the current token is predicted to be $max_gnu_stack_index = 0; $max_gnu_item_index = -1; - $gnu_stack[0] = new_lp_indentation_item( 0, -1, -1, 0, 0 ); - @gnu_item_list = (); - $last_output_indentation = 0; - $last_indentation_written = 0; - $last_unadjusted_indentation = 0; - $last_leading_token = ""; + $gnu_stack[0] = new_lp_indentation_item( 0, -1, -1, 0, 0 ); + @gnu_item_list = (); + $last_output_indentation = 0; + $last_indentation_written = 0; + $last_unadjusted_indentation = 0; + $last_leading_token = ""; $last_output_short_opening_token = 0; $saw_VERSION_in_this_file = !$rOpts->{'pass-version-line'}; @@ -1586,7 +1586,7 @@ sub break_lines { # out of __END__ and __DATA__ sections, because # the user may be using this section for any purpose whatsoever if ( $rOpts->{'delete-pod'} ) { $skip_line = 1; } - if ( $rOpts->{'tee-pod'} ) { $tee_line = 1; } + if ( $rOpts->{'tee-pod'} ) { $tee_line = 1; } if ( $rOpts->{'trim-pod'} ) { $input_line =~ s/\s+$// } if ( !$skip_line && !$in_format_skipping_section @@ -1849,7 +1849,7 @@ sub initialize_whitespace_hashes { $binary_ws_rules{'t'}{'L'} = WS_NO; $binary_ws_rules{'t'}{'{'} = WS_NO; $binary_ws_rules{'}'}{'L'} = WS_NO; - $binary_ws_rules{'}'}{'{'} = WS_OPTIONAL; # RT#129850; was WS_NO + $binary_ws_rules{'}'}{'{'} = WS_OPTIONAL; # RT#129850; was WS_NO $binary_ws_rules{'$'}{'L'} = WS_NO; $binary_ws_rules{'$'}{'{'} = WS_NO; $binary_ws_rules{'@'}{'L'} = WS_NO; @@ -5683,9 +5683,9 @@ EOM ); } - # Note: there are additional parameters that can be made inactive by - # -iob, but they are on by default so we would generate excessive - # warnings if we noted them. They are: + # Note: there are additional parameters that can be made inactive by + # -iob, but they are on by default so we would generate excessive + # warnings if we noted them. They are: # $rOpts->{'break-at-old-keyword-breakpoints'} # $rOpts->{'break-at-old-logical-breakpoints'} # $rOpts->{'break-at-old-ternary-breakpoints'} @@ -5912,9 +5912,9 @@ sub bad_pattern { $rcuddled_block_types->{$start}->{$word} = 1; #"$string_count.$word_count"; - # git#9: Remove this word from the list of desired one-line - # blocks - $want_one_line_block{$word} = 0; + # git#9: Remove this word from the list of desired one-line + # blocks + $want_one_line_block{$word} = 0; } } return; @@ -9735,7 +9735,7 @@ sub send_lines_to_vertical_aligner { my $ibeg = $ri_first->[$n]; my $iend = $ri_last->[$n]; - delete_needless_alignments($ibeg, $iend ); + delete_needless_alignments( $ibeg, $iend ); my ( $rtokens, $rfields, $rpatterns ) = make_alignment_patterns( $ibeg, $iend ); @@ -9932,28 +9932,28 @@ sub send_lines_to_vertical_aligner { # map certain operators to the same class for pattern matching %operator_map = ( - '!~' => '=~', - '+=' => '+=', - '-=' => '+=', - '*=' => '+=', - '/=' => '+=', - ); + '!~' => '=~', + '+=' => '+=', + '-=' => '+=', + '*=' => '+=', + '/=' => '+=', + ); } sub delete_needless_alignments { my ( $ibeg, $iend ) = @_; - # Remove unwanted alignments. This routine is a place to remove alignments - # which might cause problems at later stages. There are currently - # two types of fixes: + # Remove unwanted alignments. This routine is a place to remove alignments + # which might cause problems at later stages. There are currently + # two types of fixes: - # 1. Remove excess parens - # 2. Remove alignments within 'elsif' conditions + # 1. Remove excess parens + # 2. Remove alignments within 'elsif' conditions - # Patch #1: Excess alignment of parens can prevent other good - # alignments. For example, note the parens in the first two rows of - # the following snippet. They would normally get marked for alignment - # and aligned as follows: + # Patch #1: Excess alignment of parens can prevent other good + # alignments. For example, note the parens in the first two rows of + # the following snippet. They would normally get marked for alignment + # and aligned as follows: # my $w = $columns * $cell_w + ( $columns + 1 ) * $border; # my $h = $rows * $cell_h + ( $rows + 1 ) * $border; @@ -9971,25 +9971,25 @@ sub send_lines_to_vertical_aligner { # the exception that we always keep alignment of the first opening # paren on a line (for things like 'if' and 'elsif' statements). - # Setup needed constants - my $i_good_paren = -1; - my $imin_match = $iend + 1; + # Setup needed constants + my $i_good_paren = -1; + my $imin_match = $iend + 1; my $i_elsif_close = $ibeg - 1; my $i_elsif_open = $iend + 1; if ( $iend > $ibeg ) { if ( $types_to_go[$ibeg] eq 'k' ) { - # Paren patch: mark a location of a paren we should keep, such - # as one following something like a leading 'if', 'elsif',.. + # Paren patch: mark a location of a paren we should keep, such + # as one following something like a leading 'if', 'elsif',.. $i_good_paren = $ibeg + 1; if ( $types_to_go[$i_good_paren] eq 'b' ) { $i_good_paren++; } - # 'elsif' patch: remember the range of the parens of an elsif, - # and do not make alignments within them because this can cause - # loss of padding and overall brace alignment in the vertical - # aligner. + # 'elsif' patch: remember the range of the parens of an elsif, + # and do not make alignments within them because this can cause + # loss of padding and overall brace alignment in the vertical + # aligner. if ( $tokens_to_go[$ibeg] eq 'elsif' && $i_good_paren < $iend && $tokens_to_go[$i_good_paren] eq '(' ) @@ -10000,13 +10000,13 @@ sub send_lines_to_vertical_aligner { } } - # Loop to make the fixes on this line + # Loop to make the fixes on this line my @imatch_list; for my $i ( $ibeg .. $iend ) { if ( $matching_token_to_go[$i] ne '' ) { - # Patch #2: undo alignment within elsif parens + # Patch #2: undo alignment within elsif parens if ( $i > $i_elsif_open && $i < $i_elsif_close ) { $matching_token_to_go[$i] = ''; next; diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index 72bbf5f6..34c26e78 100644 --- a/lib/Perl/Tidy/HtmlWriter.pm +++ b/lib/Perl/Tidy/HtmlWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::HtmlWriter; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; use File::Basename; diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index 7c98aafb..881cee30 100644 --- a/lib/Perl/Tidy/IOScalar.pm +++ b/lib/Perl/Tidy/IOScalar.pm @@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar; use strict; use warnings; use Carp; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { my ( $package, $rscalar, $mode ) = @_; diff --git a/lib/Perl/Tidy/IOScalarArray.pm b/lib/Perl/Tidy/IOScalarArray.pm index 0f152f0e..e4f6c8e7 100644 --- a/lib/Perl/Tidy/IOScalarArray.pm +++ b/lib/Perl/Tidy/IOScalarArray.pm @@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray; use strict; use warnings; use Carp; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { my ( $package, $rarray, $mode ) = @_; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index 9eb7d51d..ec5d3802 100644 --- a/lib/Perl/Tidy/IndentationItem.pm +++ b/lib/Perl/Tidy/IndentationItem.pm @@ -8,7 +8,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { diff --git a/lib/Perl/Tidy/LineBuffer.pm b/lib/Perl/Tidy/LineBuffer.pm index fdd18151..fd82d129 100644 --- a/lib/Perl/Tidy/LineBuffer.pm +++ b/lib/Perl/Tidy/LineBuffer.pm @@ -12,7 +12,7 @@ package Perl::Tidy::LineBuffer; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { diff --git a/lib/Perl/Tidy/LineSink.pm b/lib/Perl/Tidy/LineSink.pm index 2719e7fe..0f6d7be8 100644 --- a/lib/Perl/Tidy/LineSink.pm +++ b/lib/Perl/Tidy/LineSink.pm @@ -8,7 +8,7 @@ package Perl::Tidy::LineSink; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { diff --git a/lib/Perl/Tidy/LineSource.pm b/lib/Perl/Tidy/LineSource.pm index 3b89ca8f..2b0f2fb0 100644 --- a/lib/Perl/Tidy/LineSource.pm +++ b/lib/Perl/Tidy/LineSource.pm @@ -8,7 +8,7 @@ package Perl::Tidy::LineSource; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index 332767af..5eb93b8c 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -7,7 +7,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; sub new { diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 48f8f937..60ad3392 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -21,7 +21,7 @@ package Perl::Tidy::Tokenizer; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; use Perl::Tidy::LineBuffer; @@ -3221,7 +3221,7 @@ EOM elsif ( ( $next_nonblank_token eq ':' ) && ( $rtokens->[ $i_next + 1 ] ne ':' ) - && ( $i_next <= $max_token_index ) # colon on same line + && ( $i_next <= $max_token_index ) # colon on same line && label_ok() ) { @@ -4226,12 +4226,12 @@ sub operator_expected { else { if ( $tok =~ /^([x\/\+\-\*\%\&\.\?\<]|\>\>)$/ ) { - # Do not complain in 'use' statements, which have special syntax. - # For example, from RT#130344: - # use lib $FindBin::Bin . '/lib'; - if ($statement_type ne 'use') { + # Do not complain in 'use' statements, which have special syntax. + # For example, from RT#130344: + # use lib $FindBin::Bin . '/lib'; + if ( $statement_type ne 'use' ) { complain("operator in print statement not recommended\n"); - } + } $op_expected = OPERATOR; } } diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 6f4eff25..c22b84ea 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -1,7 +1,7 @@ package Perl::Tidy::VerticalAligner; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; use Perl::Tidy::VerticalAligner::Alignment; use Perl::Tidy::VerticalAligner::Line; @@ -2326,7 +2326,7 @@ sub delete_unmatched_tokens { # This is a preliminary step in vertical alignment in which we remove as # many obviously un-needed alignment tokens as possible. This will prevent - # them from interfering with the final alignment. + # them from interfering with the final alignment. return unless @{$rlines}; my $has_terminal_match = $rlines->[-1]->get_j_terminal_match(); @@ -2337,7 +2337,7 @@ sub delete_unmatched_tokens { my @i_equals; my @min_levels; - my $jmax = @{$rnew_lines}-1; + my $jmax = @{$rnew_lines} - 1; my %is_good_tok; @@ -2350,22 +2350,26 @@ sub delete_unmatched_tokens { my $i_eq; my $lev_min; foreach my $tok ( @{$rtokens} ) { - my $lev=0; - my $raw_tok=""; - my $desc=""; - if ($tok =~ /^(\D+)(\d+)(.*)/) { $raw_tok=$1; $lev = $2; $desc=$3} - if (!defined($lev_min) || $lev < $lev_min) {$lev_min=$lev} + my $lev = 0; + my $raw_tok = ""; + my $desc = ""; + if ( $tok =~ /^(\D+)(\d+)(.*)/ ) { + $raw_tok = $1; + $lev = $2; + $desc = $3; + } + if ( !defined($lev_min) || $lev < $lev_min ) { $lev_min = $lev } $rhash->{$tok} = [ $i, undef, undef, $lev ]; # remember the first equals at line level - if ( !defined($i_eq) && $raw_tok eq '=') { + if ( !defined($i_eq) && $raw_tok eq '=' ) { if ( $lev eq $group_level ) { $i_eq = $i } } $i++; } push @{$rline_hashes}, $rhash; - push @i_equals, $i_eq; + push @i_equals, $i_eq; push @min_levels, $lev_min; } @@ -2373,12 +2377,12 @@ sub delete_unmatched_tokens { my $rtok_hash = {}; my $nr = 0; for ( my $jl = 0 ; $jl < $jmax ; $jl++ ) { - my $nl = $nr; - $nr = 0; + my $nl = $nr; + $nr = 0; my $jr = $jl + 1; my $rhash_l = $rline_hashes->[$jl]; my $rhash_r = $rline_hashes->[$jr]; - my $count = 0; # UNUSED NOW? + my $count = 0; # UNUSED NOW? my $ntoks = 0; foreach my $tok ( keys %{$rhash_l} ) { $ntoks++; @@ -2390,12 +2394,12 @@ sub delete_unmatched_tokens { $rhash_r->{$tok}->[1] = $il; if ( $tok ne '#' ) { push @{ $rtok_hash->{$tok} }, ( $jl, $jr ); - $nr++; + $nr++; } } } - # Set a line break if no matching tokens between these lines + # Set a line break if no matching tokens between these lines if ( $nr == 0 && $nl > 0 ) { $rnew_lines->[$jl]->{_end_group} = 1; } @@ -2431,11 +2435,11 @@ sub delete_unmatched_tokens { } # Look for if/else/elsif and ternary blocks - my $is_full_block; + my $is_full_block; foreach my $tok ( keys %token_line_count ) { if ( $token_line_count{$tok} == $nlines ) { if ( $tok =~ /^\?/ || $tok =~ /^\{\d+if/ ) { - $is_full_block = 1; + $is_full_block = 1; } } } @@ -2489,7 +2493,7 @@ sub delete_unmatched_tokens { } } # End loop over subgroups - return; + return; } sub decide_if_aligned_pair { diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index f61d0c61..ca798416 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -7,7 +7,7 @@ package Perl::Tidy::VerticalAligner::Alignment; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; { diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index e62ce3e7..68a7f9fa 100644 --- a/lib/Perl/Tidy/VerticalAligner/Line.pm +++ b/lib/Perl/Tidy/VerticalAligner/Line.pm @@ -8,7 +8,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; -our $VERSION = '20190601.01'; +our $VERSION = '20190915'; {