Log message:
Update to 20240903
Upstream changes:
## 2024 09 03
- Add partial support for Syntax::Operator::In and Syntax::Keyword::Match
(see git #162).
- Add --timeout-in-seconds=n, or -tos=n. When the standard input supplies
the input stream, and the input has not been received within n seconds,
perltidy will end with a timeout message. The intention is to catch
a situation where perltidy is accidentally invoked without a file to
process and therefore waits for input from the system standard input
(stdin), which never arrives. The default is n=10.
This check can be turned off with -tos=0.
- Add parameter --closing-side-comment-exclusion-list=string, or
-cscxl=string, where string is a list of block types to exclude
for closing side comment operations. Also, closing side comments
now work for anonymous subs if a --closing-side-comment-list (-cscl)
is not specified, and when 'asub' is requested with -cscl=asub.
Use -cscxl=asub to prevent this.
- Include check for unused constants in --dump-unusual-variables and
--warn-variable-types (new issue type 'c'). Also expand checks to
cover variables introduced with 'use vars'.
- Include signature variables in --dump-unusual-variables and
--warn-variable-types; see git #158.
- Add logical xor operator ^^ available in perl version 5.40, as
noted in git #157.
- Keyword 'state' now has default space before a paren, like 'my'.
Previously there was no space and no control. So the default
is now "state ($x)". This space can be removed with -nsak='state'.
- Add options --add-lone-trailing-commas, -altc and
--delete-lone-trailing-commas, -dltc, to provide control over adding
and deleting the only comma in a list. See discussion in git #143
and the updated manual.
- Add options --dump-mismatched-returns (or -dmr) and
--warn-mismatched-returns (or -wmr). These options report function
calls where the number of values requested may disagree with sub
return statements. The -dump version writes the results for a single
file to standard output and exits:
perltidy -dmr somefile.pl >results.txt
The -warn version formats as normal but reports any issues as warnings in
the error file:
perltidy -wmr somefile.pl
The -warn version may be customized with the following additional
parameters if necessary to avoid needless warnings:
--warn-mismatched-return-types=s (or -wmrt=s),
--warn-mismatched-return-exclusion-list=s (or -wmrxl=s)
where 's' is a control string. These are explained in the manual.
- Updates for issue git #151:
(1) --warn-variable-types=u is now okay if a named file is processed.
(2) --warn-variable-exclusion-list=s now allows leading and/or
trailing * on variable names to allow a wildcard match. For example
-wvxl='*_unused' is okay and would match $var1_unused and $var2_unused.
(3) --dump-unusual-variables now outputs the filename.
- A option was added to filter unimplemented parameters from perltidy
configuration files, suggested in git #146. It works like this: if
a line in the config file begins with three dashes followed by a
parameter name (rather than two dashes), then the line will be removed
if the parameter is unknown. Otherwise, a dash will be removed to make
the line valid.
- Parameters --dump-mismatched-args (or -dma) and
--warn-mismatched-args (or -wma) have been updated to catch more
arg count issues.
- Fixed issue git #143, extend -add-trailing-commas to apply to a list
with just a fat comma.
- The minimum perl version is 5.8.1. Previously it was 5.8.0, which was
not correct because of the use of utf8::is_utf8.
- Fixed issue git #142, test failure installing on perl versions before
version 5.10. The error caused the new parameter
-interbracket-arrow-style=s not to work. Except for this limitation,
Version 20240511 will work on older perl versions.
|
Log message:
Update to 20240511
Upstream changes:
## 2024 05 11
- The option --valign-signed-numbers, or -vsn is now the default. It
was introduced in the previous release has been found to significantly
improve the overall appearance of columns of signed and unsigned
numbers. See the previous Change Log entry for an example.
This will change the formatting in scripts with columns
of vertically aligned signed and unsigned numbers.
Use -nvsn to turn this option off and avoid this change.
- Previously, a line break was made before a short concatenated terminal
quoted string, such as "\n", if the previous line had a greater
starting indentation. The break is now placed after the short quote.
This keeps code a little more compact. For example:
# old rule: break before "\n" here because '$name' has more \
indentation:
my $html = $this->SUPER::genObject( $query, $bindNode, $field . \
":$var",
$name, "remove", "UNCHECKED" )
. "\n";
# new rule: break after a short terminal quote like "\n" for \
compactness;
my $html = $this->SUPER::genObject( $query, $bindNode, $field . \
":$var",
$name, "remove", "UNCHECKED" ) . "\n";
- The option --delete-repeated-commas is now the default.
It makes the following checks and changes:
- Repeated commas like ',,' are removed with a warning
- Repeated fat commas like '=> =>' are removed with a warning
- The combination '=>,' produces a warning but is not changed
These warnings are only output if --warning-output, or -w, is set.
Use --nodelete-repeated-commas, or -ndrc, to retain repeated commas.
- The operator ``**=`` now has spaces on both sides by default. Previously,
there was no space on the left. This change makes its spacing the same
as all other assignment operators. The previous behavior can be obtained
with the parameter setting -nwls='**='.
- The option --file-size-order, or -fso is now the default. When
perltidy is given a list of multiple filenames to process, they
are sorted by size and processed in order of increasing size.
This can significantly reduce memory usage by Perl. This
option has always been used in testing, where typically several
jobs each operating on thousands of filenames are running at the
same time and competing for system resources. If this option
is not wanted for some reason, it can be deactivated with -nfso.
- In the option --dump-block-summary, the number of sub arguments indicated
for each sub now includes any leading object variable passed with
an arrow-operator call. Previously the count would have been decreased
by one in this case. This change is needed for compatibility with future
updates.
- Fix issue git #138 involving -xlp (--extended-line-up-parentheses).
When multiple-line quotes and regexes have long secondary lines, these
line lengths could influencing some spacing and indentation, but they
should not have since perltidy has no control over their indentation.
This has been fixed. This will mainly influence code which uses -xlp
and has long multi-line quotes.
- Add option --minimize-continuation-indentation, -mci (see git #137).
This flag allows perltidy to remove continuation indentation in some
special cases where it is not really unnecessary. For a simple example,
the default formatting for the following snippet is:
# perltidy -nmci
$self->blurt( "Error: No INPUT definition for type '$type', \
typekind '"
. $type->xstype
. "' found" );
The second and third lines are one level deep in a container, and
are also statement continuations, so they get indented by the sum
of the -i value and the -ci value. If this flag is set, the
indentation is reduced by -ci spaces, giving
# perltidy -mci
$self->blurt( "Error: No INPUT definition for type '$type', \
typekind '"
. $type->xstype
. "' found" );
This situation is relatively rare except in code which has long
quoted strings and the -nolq flag is also set. This flag is currently
off by default, but it could become the default in a future version.
- Add options --dump-mismatched-args (or -dma) and
--warn-mismatched-arg (or -wma). These options look
for and report instances where the number of args expected by a
sub appear to differ from the number passed to the sub. The -dump
version writes the results for a single file to standard output
and exits:
perltidy -dma somefile.pl >results.txt
The -warn version formats as normal but reports any issues as warnings in
the error file:
perltidy -wma somefile.pl
The -warn version may be customized with the following additional parameters
if necessary to avoid needless warnings:
--warn-mismatched-arg-types=s (or -wmat=s),
--warn-mismatched-arg-exclusion-list=s (or -wmaxl=s), and
--warn-mismatched-arg-undercount-cutoff=n (or -wmauc=n).
--warn-mismatched-arg-overcount-cutoff=n (or -wmaoc=n).
These are explained in the manual.
- Add option --valign-wide-equals, or -vwe, for issue git #135.
Setting this parameter causes the following assignment operators
= **= += *= &= <<= &&= -= /= |= >>= ||= //= .= \
%= ^= x=
to be aligned vertically with the ending = all aligned. For example,
here is the default formatting of a snippet of code:
$str .= SPACE x $total_pad_count;
$str_len += $total_pad_count;
$total_pad_count = 0;
$str .= $rfields->[$j];
$str_len += $rfield_lengths->[$j];
And here is the same code formatted with -vwe:
# perltidy -vwe
$str .= SPACE x $total_pad_count;
$str_len += $total_pad_count;
$total_pad_count = 0;
$str .= $rfields->[$j];
$str_len += $rfield_lengths->[$j];
This option currently is off by default to avoid changing existing
formatting.
- Added control --delete-interbracket-arrows, or -dia, to delete optional
hash ref and array ref arrows between brackets as in the following
expression (see git #131)
return \
$self->{'commandline'}->{'arg_list'}->[0]->[0]->{'hostgroups'};
# perltidy -dia gives:
return $self->{'commandline'}{'arg_list'}[0][0]{'hostgroups'};
Added the opposite control --aia-interbracket-arrows, or -aia, to
add arrows. So applied to the previous line the arrows are restored:
# perltidy -aia
return \
$self->{'commandline'}->{'arg_list'}->[0]->[0]->{'hostgroups'};
The manual describes additional controls for adding and deleting
just selected interbracket arrows.
|
Log message:
Update to 20230701
Upstream changes:
## 2023 07 01
- Issue git #121. Added parameters -xbt, or --extended-block-tightness,
and -xbtl=s, or --extended-block-tightness-list=s, to allow
certain small code blocks to have internal spacing controlled by
-bbt=n rather than -bt=n. The man pages have details.
- Issue git #118. A warning will be issued if a duplicate format-skipping
starting marker is seen within a format-skipping section. The same
applies to duplicate code-skipping starting markers within code-skipping
sections.
- Issue git #116. A new flag --valign-if-unless, -viu, was added to
allow postfix 'unless' terms to align with postfix 'if' terms. The
default remains not to do this.
- Fixed git #115. In the two most recent CPAN releases, when the
Perl::Tidy module was called with the source pointing to a file,
but no destination specified, the output went to the standard
output instead of to a file with extension ``.tdy``, as it should
have. This has been fixed.
- Fixed git #110, add missing documentation for new options
-cpb and -bfvt=n. These work in version 20230309 but the pod
documentation was missing and has been added.
- Fixed an undefined reference message when running with
--dump-block-summary on a file without any subs or other
selected block types.
- Add parameter -ipc, or --ignore-perlcritic-comments. Perltidy, by
default, will look for side comments beginning with ``## no critic`` and
ignore their lengths when making line break decisions, even if the user
has not set ``-iscl``. The reason is that an unwanted line break can
make these special comments ineffective in controlling ``perlcritic``.
The parameter -ipc can be set if, for some reason, this is not wanted.
- Some minor issues with continuation indentation have been fixed.
Most scripts will remain unchanged. The main change is that block
comments which occur just before a closing brace, bracket or paren
now have an indentation which is independent of the existance of
an optional comma or semicolon. Previously, adding or deleting
an optional trailing comma could cause their indentation to jump.
Also, indentation of comments within ternary statements has been
improved. For additonal details see:
https://github.com/perltidy/perltidy/blob/master/docs/ci_update.md
- This version was stress-tested for many cpu hours with random
input parameters. No failures to converge, internal fault checks,
undefined variable references or other irregularities were seen.
- This version runs several percent faster than the previous release
on large files.
|
Log message:
Update to 20211029
Upstream changes:
## 2021 10 29
- No significant bugs have been found since the last release, but several
minor issues have been fixed. Vertical alignment has been improved for
lists of call args which are not contained within parens (next item).
- Vertical alignment of function calls without parens has been improved with
the goal of making vertical alignment essentially the same with or
without parens around the call args. Some examples:
# OLD
mkTextConfig $c, $x, $y, -anchor => 'se', $color;
mkTextConfig $c, $x + 30, $y, -anchor => 's', $color;
mkTextConfig $c, $x + 60, $y, -anchor => 'sw', $color;
mkTextConfig $c, $x, $y + 30, -anchor => 'e', $color;
# NEW
mkTextConfig $c, $x, $y, -anchor => 'se', $color;
mkTextConfig $c, $x + 30, $y, -anchor => 's', $color;
mkTextConfig $c, $x + 60, $y, -anchor => 'sw', $color;
mkTextConfig $c, $x, $y + 30, -anchor => 'e', $color;
# OLD
is id_2obj($id), undef, "unregistered object not retrieved";
is scalar keys %$ob_reg, 0, "object registry empty";
is register($obj), $obj, "object returned by register";
is scalar keys %$ob_reg, 1, "object registry nonempty";
is id_2obj($id), $obj, "registered object retrieved";
# NEW
is id_2obj($id), undef, "unregistered object not \
retrieved";
is scalar keys %$ob_reg, 0, "object registry empty";
is register($obj), $obj, "object returned by register";
is scalar keys %$ob_reg, 1, "object registry nonempty";
is id_2obj($id), $obj, "registered object retrieved";
This will cause some changes in alignment, hopefully for the better,
particularly in test code which often uses numerous parenless function
calls with functions like 'ok', 'is', 'is_deeply', ....
- Two new parameters were added to control the block types to which the
-bl (--opening-brace-on-new-line) flag applies. The new parameters are
-block-left-list=s, or -bll=s, and --block-left-exclusion-list=s,
or -blxl=s. Previously the -bl flag was 'hardwired' to apply to
nearly all blocks. The default values of the new parameters
retain the the old default behavior but allow it to be changed.
- The default behavior of the -bli (-brace-left-and-indent) flag has changed
slightly. Previously, if you set -bli, then the -bl flag would also
automatically be set. Consequently, block types which were not included
in the default list for -bli would get -bl formatting. This is no longer done,
and these two styles are now controlled independently. The manual describes
the controls. If you want to recover the exact previous default behavior of
the -bli then add the -bl flag.
- A partial fix was made for issue for git #74. The -lp formatting style was
being lost when a one-line anonymous sub was followed by a closing brace.
- Fixed issue git #73, in which the -nfpva flag was not working correctly.
Some unwanted vertical alignments of spaced function perens
were being made.
- Updated the man pages to clarify the flags -valign and -novalign
for turning vertical alignment on and off (issue git #72).
Added parameters -vc -vsc -vbc for separately turning off vertical
alignment of code, side comments and block comments.
- Fixed issue git #68, where a blank line following a closing code-skipping
comment, '#>>V', could be lost.
- This version runs 10 to 15 percent faster on large files than the
previous release due to optimizations made with the help of NYTProf.
- This version of perltidy was stress-tested for many cpu hours with
random input parameters. No instabilities, internal fault checks,
undefined variable references or other irregularities were seen.
- Numerous minor fixes have been made, mostly very rare formatting instabilities
found in random testing. An effort has been made to minimize changes to
existing formatting that these fixes produce, but occasional changes
may occur. Many of these updates are listed at:
https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
|