From: Steve Hancock Date: Sun, 1 Dec 2024 21:22:10 +0000 (-0800) Subject: bump version to 20240903.07 X-Git-Tag: 20240903.07^0 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=34fa0a5563da2fc5510a0b1a9cf33c33740458e7;p=perltidy.git bump version to 20240903.07 --- diff --git a/CHANGES.md b/CHANGES.md index 0ba126ce..df714faa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Perltidy Change Log -## 2024 09 03.06 +## 2024 09 03.07 - Added parameter --indent-leading-semicolon, -ils; see git #171. When this is negated, a line with a leading semicolon does not get the extra diff --git a/bin/perltidy b/bin/perltidy index b69b1d07..cb6c1a69 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -7254,7 +7254,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20240903.06 +This man page documents perltidy version 20240903.07 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index c07366bc..016b15c4 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,8 +1,21 @@

Perltidy Change Log

-

2024 09 03.06

+

2024 09 03.07

-
- Added parameter --break-at-trailing-comma-types=s, or -btct=s, where
+
- Added parameter --indent-leading-semicolon, -ils; see git #171. When
+this is negated, a line with a leading semicolon does not get the extra
+leading continuation indentation spaces (defined with -ci=n).
+
+- Space around here doc delimiters follow spacing controls better. For
+example, a space is now added before the closing paren here:
+
+   OLD: (without the here doc):
+   push( @script, <<'EOT');
+
+   NEW:
+   push( @script, <<'EOT' );
+
+- Added parameter --break-at-trailing-comma-types=s, or -btct=s, where
 s is a string which selects trailing commas.  For example, -btct='f(b'
 places a line break after all bare trailing commas in function calls.
 The manual has details.
diff --git a/docs/Tidy.html b/docs/Tidy.html
index 0014becc..d8db4005 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20240903.06

+

This man page documents Perl::Tidy version 20240903.07

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index 51fc1fe9..1c82f90a 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -237,7 +237,7 @@

If the path contains spaces, it should be placed in quotes.

-

This parameter will be ignored if output is being directed to standard output, or if it is being specified explicitly with the -outfile=s parameter.

+

This parameter will be ignored if output is being directed to standard output, or if it is being specified explicitly with the --outfile=s parameter.

-b, --backup-and-modify-in-place
@@ -249,7 +249,7 @@

A -b flag will be ignored if input is from standard input or goes to standard output, or if the -html flag is set.

-

In particular, if you want to use both the -b flag and the --perl-best-practices (-pbp) flag, then you must put a -nostandard-output (-nst) flag after the -pbp flag because it contains a --standard-output flag as one of its components, which means that output will go to the standard output stream.

+

In particular, if you want to use both the -b flag and the --perl-best-practices (-pbp) flag, then you must put a --nostandard-output (-nst) flag after the -pbp flag because it contains a --standard-output flag as one of its components, which means that output will go to the standard output stream.

-bext=ext, --backup-file-extension=ext
@@ -377,7 +377,7 @@

If --format=tidy (the default) then perltidy will reformat the input file, and if --format=html then perltidy will produce html output.

-

For convenience, the abbreviation --tidy is equivalent to --format=tidy, and --html is equivalent to --format=html.

+

For convenience, the abbreviation --tidy is equivalent to --format=tidy, and -html is equivalent to --format=html.

--notidy
@@ -704,7 +704,7 @@
  • A limitation on -lp, but not -xlp, occurs in situations where perltidy does not have complete freedom to choose line breaks. Then it may temporarily revert to its default indentation method. This can occur for example if there are blank lines, block comments, multiline quotes, or side comments between the opening and closing parens, braces, or brackets. It will also occur if a multiline anonymous sub occurs within a container since that will impose specific line breaks (such as line breaks after statements).

  • -
  • For both the -lp and -xlp flags, any parameter which significantly restricts the ability of perltidy to choose newlines will conflict with these flags and will cause them to be deactivated. These include --indent-only, --freeze-newlines, -noadd-newlines, and -nodelete-old-newlines.

    +
  • For both the -lp and -xlp flags, any parameter which significantly restricts the ability of perltidy to choose newlines will conflict with these flags and will cause them to be deactivated. These include --indent-only, --freeze-newlines, --noadd-newlines, and --nodelete-old-newlines.

  • The -lp and -xlp options may not be used together with the -t tabs option. They may, however, be used with the -et=n tab method

    @@ -854,6 +854,24 @@

    The default is not to do this, indicated by -nicb.

    + +
    -ils, --indent-leading-semicolon
    +
    + +

    A line which begins with a leading semicolon will, by default, have the extra number of indentation spaces defined by --continuation-indentation=n. This extra indentation can be removed by setting -nils.

    + +
        # default
    +    $z = sqrt( $x**2 + $y**2 )
    +
    +      ;    # <-- indented by ci spaces
    +
    +    # -nils
    +    $z = sqrt( $x**2 + $y**2 )
    +
    +    ;    # <-- not indented by ci spaces
    + +

    Note that leading semicolons do not normally occur unless requested with --break-at-old-semicolon-breakpoints or forced, for example by a blank line as in this example.

    +
    -nib, --non-indenting-braces
    @@ -999,7 +1017,7 @@
    -xbt, --extended-block-tightness
    -

    The previous section described two controls for spacing within curly braces, namely -block-brace-tightness=n for code block braces and -brace-tightness=n for all other braces.

    +

    The previous section described two controls for spacing within curly braces, namely --block-brace-tightness=n for code block braces and --brace-tightness=n for all other braces.

    There is a little fuzziness in this division of brace types though because the curly braces considered by perltidy to contain code blocks for formatting purposes, such as highlighting code structure, exclude some of the small code blocks used by Perl mainly for isolating terms. These include curly braces following a keyword where an indirect object might occur, or curly braces following a type symbol. For example, perltidy does not mark the following braces as code block braces:

    @@ -1931,7 +1949,7 @@
    -fnl, --freeze-newlines
    -

    If you do not want any changes to the line breaks within lines of code in your script, set -fnl, and they will remain fixed, and the rest of the commands in this section and sections "Controlling List Formatting", "Retaining or Ignoring Existing Line Breaks". You may want to use -nooutdent-long-lines with this.

    +

    If you do not want any changes to the line breaks within lines of code in your script, set -fnl, and they will remain fixed, and the rest of the commands in this section and sections "Controlling List Formatting", "Retaining or Ignoring Existing Line Breaks". You may want to use --nooutdent-long-lines with this.

    Note: If you also want to keep your blank lines exactly as they are, you can use the --freeze-blank-lines flag which is described in the section "Blank Line Control".

    @@ -1956,10 +1974,10 @@ # -nce (default) if ($task) { - yyy(); + yyy(); } else { - zzz(); + zzz(); }
  • In this example the keyword else is placed on the same line which begins with the preceding closing block brace and is followed by its own opening block brace on the same line. Other keywords and function names which are formatted with this "cuddled" style are elsif, continue, catch, finally.

    @@ -1989,7 +2007,7 @@

    The built-in default cuddled block types are else, elsif, continue, catch, finally.

    -

    Additional block types to which the -cuddled-blocks style applies can be defined by this parameter. This parameter is a character string, giving a list of block types separated by commas or spaces. For example, to cuddle code blocks of type sort, map and grep, in addition to the default types, the string could be set to

    +

    Additional block types to which the --cuddled-blocks style applies can be defined by this parameter. This parameter is a character string, giving a list of block types separated by commas or spaces. For example, to cuddle code blocks of type sort, map and grep, in addition to the default types, the string could be set to

      -cbl="sort map grep"
    @@ -2009,7 +2027,7 @@
    -cblx, --cuddled-block-list-exclusive
    -

    When cuddled else formatting is selected with -cuddled-else, setting this flag causes perltidy to ignore its built-in defaults and rely exclusively on the block types specified on the --cuddled-block-list flag described in the previous section. For example, to avoid using cuddled catch and finally, which are among the defaults, the following set of parameters could be used:

    +

    When cuddled else formatting is selected with --cuddled-else, setting this flag causes perltidy to ignore its built-in defaults and rely exclusively on the block types specified on the --cuddled-block-list flag described in the previous section. For example, to avoid using cuddled catch and finally, which are among the defaults, the following set of parameters could be used:

      perltidy -ce -cbl='else elsif continue' -cblx
    @@ -2050,7 +2068,7 @@ ... }
    -

    When -bl is set, the blocks to which this applies can be controlled with the parameters --brace-left-list and -brace-left-exclusion-list described in the next sections.

    +

    When -bl is set, the blocks to which this applies can be controlled with the parameters --brace-left-list and --brace-left-exclusion-list described in the next sections.

    -bll=s, --brace-left-list=s
    @@ -2831,7 +2849,7 @@

    To simplify input even further for the case in which both opening and closing non-block containers are stacked, the flag -sac or --stack-all-containers is an abbreviation for --stack-opening-tokens --stack-closing-tokens.

    -

    Please note that if both opening and closing tokens are to be stacked, then the newer flag -weld-nested-containers may be preferable because it insures that stacking is always done symmetrically. It also removes an extra level of unnecessary indentation within welded containers. It is able to do this because it works on formatting globally rather than locally, as the --stack-opening-tokens and --stack-closing-tokens flags do.

    +

    Please note that if both opening and closing tokens are to be stacked, then the newer flag --weld-nested-containers may be preferable because it insures that stacking is always done symmetrically. It also removes an extra level of unnecessary indentation within welded containers. It is able to do this because it works on formatting globally rather than locally, as the --stack-opening-tokens and --stack-closing-tokens flags do.

    @@ -2874,7 +2892,7 @@ = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x= . : ? && || and or err xor -

    and the -bbao flag sets the default to break before all of these operators. These can be used to define an initial break preference which can be fine-tuned with the --want-break-after and --want-break-before flags. For example, to break before all operators except an = one could use --bbao -wba='=' rather than listing every single perl operator except = on a -wbb flag.

    +

    and the -bbao flag sets the default to break before all of these operators. These can be used to define an initial break preference which can be fine-tuned with the --want-break-after and --want-break-before flags. For example, to break before all operators except an = one could use -bbao -wba='=' rather than listing every single perl operator except = on a -wbb flag.

    @@ -3317,7 +3335,7 @@ 'g', Canvas => $overview_canvas ); -

    formatting with -wtc=f(b) -atc will not add a trailing comma because the list will be flattend and the comma will not remain bare. But we can add a trailing comma, and keep the container open, with

    +

    formatting with -wtc=f(b) -atc will not add a trailing comma because the list will be flattened and the comma will not remain bare. But we can add a trailing comma, and keep the container open, with

        # perltidy -wtc='f(b' -atc -btct='f(b'
         plot(
    @@ -3687,7 +3705,7 @@
           'track.id' => { -ident => 'none_search.id' },
       } )->as_query;
    -

    You may want to include the -weld-nested-containers flag in this case to keep nested braces and parens together, as in the last line.

    +

    You may want to include the --weld-nested-containers flag in this case to keep nested braces and parens together, as in the last line.

    -bos, --break-at-old-semicolon-breakpoints
    @@ -3702,11 +3720,18 @@
      $z = sqrt( $x**2 + $y**2 );
    -

    The result using perltidy -bos keeps the isolated semicolon:

    +

    Using the <-bos> flag keeps the isolated semicolon:

    -
      $z = sqrt( $x**2 + $y**2 )
    +
      # perltidy -bos
    +  $z = sqrt( $x**2 + $y**2 )
         ;
    +

    The extra continuation indentation spaces on the semicolon can be removed by also setting --noindent-leading-semicolon.

    + +
      # perltidy -bos -nils
    +  $z = sqrt( $x**2 + $y**2 )
    +  ;
    +

    The default is not to do this, -nbos.

    @@ -4266,7 +4291,7 @@
    Forming new one-line blocks
    -

    Sometimes it might be desirable to convert a script to have one-line blocks whenever possible. Although there is currently no flag for this, a simple workaround is to execute perltidy twice, once with the flag -noadd-newlines and then once again with normal parameters, like this:

    +

    Sometimes it might be desirable to convert a script to have one-line blocks whenever possible. Although there is currently no flag for this, a simple workaround is to execute perltidy twice, once with the flag --noadd-newlines and then once again with normal parameters, like this:

         cat infile | perltidy -nanl | perltidy >outfile
    @@ -4296,7 +4321,7 @@

    There is no automatic way to break existing long one-line blocks into multiple lines, but this can be accomplished by processing a script, or section of a script, with a short value of the parameter maximum-line-length=n. Then, when the script is reformatted again with the normal parameters, the blocks which were broken will remain broken (with the exceptions noted above).

    -

    Another trick for doing this for certain block types is to format one time with the -cuddled-else flag and --cuddled-break-option=2. Then format again with the normal parameters. This will break any one-line blocks which are involved in a cuddled-else style.

    +

    Another trick for doing this for certain block types is to format one time with the --cuddled-else flag and --cuddled-break-option=2. Then format again with the normal parameters. This will break any one-line blocks which are involved in a cuddled-else style.

    @@ -4751,7 +4776,7 @@

    The following flags are available for debugging. Note that all commands named --dump-... will simply write some requested information to standard output and then immediately exit.

    -

    --dump-cuddled-block-list or -dcbl will dump to standard output the internal hash of cuddled block types created by a -cuddled-block-list input string.

    +

    --dump-cuddled-block-list or -dcbl will dump to standard output the internal hash of cuddled block types created by a --cuddled-block-list input string.

    --dump-defaults or -ddf will write the default option set to standard output and quit

    @@ -5141,7 +5166,24 @@ $self->gnab_gib(42);
    -

    In this case, the sub is expecting a total of three args ($self, $v1, and $v2) but only receives two ($self and 42), so an undercount is reported. This is not necessarily an error because the sub may allow for this possibility, but it is worth checking. The simple static processing done by perltidy cannot determine which sub args are optional.

    +

    In this case, the sub is expecting a total of three args ($self, $v1, and $v2) but only receives two ($self and 42), so an undercount is reported. This is not necessarily an error because the sub may allow for this possibility, but it is worth checking.

    + +

    Although it is not possible to automatically determine which sub args are optional, if optional sub args are enclosed in an extra set of parentheses, perltidy will take this a signal that they are optional and not issue a warning. So if the above example is written as

    + +
        sub gnab_gib {
    +        my $self = shift;
    +        my ( $v1, ($v2) ) = @_;  # <-- extra parens on $v2 indicate optional
    +        ...;
    +    }
    + +

    then perltidy will consider that the second arg is optional and not issue a warning for:

    + +
        $self->gnab_gib(42);
    + +

    For multiple default call args, place one set of parens around them all. Some examples:

    + +
        my ( $v1, ( $v2, $v3 ) ) = @_;    # <-- $v2 and $v3 are optional
    +    my ( ($v1) ) = @_;                # <-- $v1 is optional
    i: indeterminate: a specific number of expected args for a sub could not be determined, but it is called with a specific number. This issue is reported for the --dump- option but not the --warn- option.
    @@ -5196,6 +5238,8 @@

    The default value is n=4. This has been found to allow most programs to pass without warnings, but it should be reduced if possible for better error checking. The minimum possible value of n needed to avoid triggering an error for a program can be determined by running with -wma -wmauc=0. If there are undercount errors, a note at the bottom of the error output indicates the value of n required to avoid reporting them.

    +

    As noted above for the parameter --dump-mismatched-args, if optional call args are enclosed in separate parentheses, then perltidy will recognize them as optional args and avoid needless warnings. If this method is used, then -wmauc=0 should be used for maximal checking.

    +
  • --warn-mismatched-arg-overcount-cutoff=n, or -wmaoc=n, can be used to avoid overcount warnings when the expected number of args is less than n. The default value is n=1. This avoids warning messages for subroutines which are dummy placeholders for possible expansion.

    @@ -5608,7 +5652,7 @@

    VERSION

    -

    This man page documents perltidy version 20240903.06

    +

    This man page documents perltidy version 20240903.07

    BUG REPORTS

    diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 98492b96..2896d37d 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -136,7 +136,7 @@ BEGIN { # then the Release version must be bumped, and it is probably past time for # a release anyway. - $VERSION = '20240903.06'; + $VERSION = '20240903.07'; } ## end BEGIN sub DESTROY { diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 4224d030..055ed47d 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -469,7 +469,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t =head1 VERSION -This man page documents Perl::Tidy version 20240903.06 +This man page documents Perl::Tidy version 20240903.07 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 1596b6fb..1d91bb7f 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index fd3da009..ed053c9d 100644 --- a/lib/Perl/Tidy/Diagnostics.pm +++ b/lib/Perl/Tidy/Diagnostics.pm @@ -18,7 +18,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index b5a017bc..df5cb601 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -16,7 +16,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; use Carp; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 42af4e3e..daaab609 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -76,7 +76,7 @@ use constant BACKSLASH => q{\\}; use Carp; use English qw( -no_match_vars ); use List::Util qw( min max first ); # min, max first are in Perl 5.8 -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index 7269720e..33dfcaf3 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 = '20240903.06'; +our $VERSION = '20240903.07'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index 46174da0..2bbf0a99 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 = '20240903.06'; +our $VERSION = '20240903.07'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/IOScalarArray.pm b/lib/Perl/Tidy/IOScalarArray.pm index 2f4912d0..d04fc567 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 = '20240903.06'; +our $VERSION = '20240903.07'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index 1816d425..d10af450 100644 --- a/lib/Perl/Tidy/IndentationItem.pm +++ b/lib/Perl/Tidy/IndentationItem.pm @@ -9,7 +9,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index adc3bae8..aacd4745 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 50f81d7c..72b66c0f 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -33,7 +33,7 @@ use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index b102727c..3ad8059d 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -5,7 +5,7 @@ use Carp; { #<<< A non-indenting brace to contain all lexical variables -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; use English qw( -no_match_vars ); use Scalar::Util 'refaddr'; # perl 5.8.1 and later use Perl::Tidy::VerticalAligner::Alignment; diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 03424882..e7cf0556 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -9,7 +9,7 @@ package Perl::Tidy::VerticalAligner::Alignment; use strict; use warnings; -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; sub new { my ( $class, $rarg ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index afaf8a2d..b1d17ef2 100644 --- a/lib/Perl/Tidy/VerticalAligner/Line.pm +++ b/lib/Perl/Tidy/VerticalAligner/Line.pm @@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; -our $VERSION = '20240903.06'; +our $VERSION = '20240903.07'; use English qw( -no_match_vars ); sub AUTOLOAD {