of indentation. Certain other features are incompatible with this
option, and if these options are also given, then a warning message will
be issued and this flag will be unset. One example is the B<-lp>
-option. This flag is retained for backwards compatability, but
+option. This flag is retained for backwards compatibility, but
if you use tabs, the B<-et=n> flag is recommended.
=item B<-dt=n>, B<--default-tabsize=n>
This flag allows perltidy to use some improvements which have been made to its
indentation model. One of the things it does is "extend" continuation
indentation deeper into structures, hence the name. The improved indentation
-is particularly noticable when the flags B<-ci=n> and B<-i=n> use the same value of
+is particularly noticeable when the flags B<-ci=n> and B<-i=n> use the same value of
B<n>. There are no significant disadvantages to using this flag, but to avoid
disturbing existing formatting the default is not to use it, B<-nxci>.
-lpxl='[ {'
means do B<NOT> include use -lp formatting within square-bracets or braces. The only unspecified
-container is '(', so this string means that only the contens within parens will use -lp indentation.
+container is '(', so this string means that only the contents within parens will use -lp indentation.
An optional numeric code may follow any of the container types to further refine the selection based
on container contents. The numeric codes are:
Despite these precautions, it is still possible to introduce syntax errors with
some asymmetric whitespace rules, particularly when call parameters are not
-placed in containg parens or braces. For example, the following two lines will
+placed in containing parens or braces. For example, the following two lines will
be parsed by perl without a syntax error:
# original programming, syntax ok
'^K(' - exclude a leading paren preceded by a non-keyword
'.k(' - exclude a secondary paren preceded by a keyword
'[ {' - exclude all brackets and braces
- '[ ( ^K{' - exclude everthing except nested structures like do {{ ... }}
+ '[ ( ^K{' - exclude everything except nested structures like do {{ ... }}
=item B<Vertical tightness> of non-block curly braces, parentheses, and square brackets.
are not actual problems with perltidy, so going through these results can take
some time.
-For example, you might have a random script which has a line begining with
+For example, you might have a random script which has a line beginning with
```=txt```, so perl will take that as the start of pod. Then if the flag to
delete pod is set, the output file will be truncated and this could trigger a
warning that the output file looks too short.
<dt id="Fix-definition-of-list-within-list-for--bbx-flags"><b>Fix definition of list within list for -bbx flags</b></dt>
<dd>
-<p>Testing produced a blinking state involving a -bbx=2 flag with an unusual combination of other parameters. The problem was traced to the definition of a list containg another list being too restrictive. This update fixes case 1024.</p>
+<p>Testing produced a blinking state involving a -bbx=2 flag with an unusual combination of other parameters. The problem was traced to the definition of a list containing another list being too restrictive. This update fixes case 1024.</p>
<p>17 Mar 2021, 7f5da0a.</p>
<dt id="Fix-issue-git-54-involving--bbp-n-and--bbpi-n"><b>Fix issue git#54 involving -bbp=n and -bbpi=n</b></dt>
<dd>
-<p>In this issue, different results were obtained depending upon the existance of a comma in a list. To fix this, the definition of a list was adjusted from requiring one or more commas to requiring either a fat comma or a comma.</p>
+<p>In this issue, different results were obtained depending upon the existence of a comma in a list. To fix this, the definition of a list was adjusted from requiring one or more commas to requiring either a fat comma or a comma.</p>
<p>At the same time, a known problem involving the combination -lp -bbp=n -bbpi=n was fixed. This fixes cases b826 b909 b989.</p>
<p>The previous update was found to occasionally needlessly change existing formatting with very long long lines. So it is restricted to just when -vmll is set. For example, it is ok to keep the long quote following the opening paren in the following case.</p>
<pre><code> # perltidy -gnu
- ok( "got to the end without dieing (note without DEBUGGING passing this test means nothing)"
+ ok( "got to the end without dying (note without DEBUGGING passing this test means nothing)"
);</code></pre>
<p>26 Feb 2021, 2b88464.</p>
<dt id="Avoid-line-breaks-after-token-type-G"><b>Avoid line breaks after token type 'G'</b></dt>
<dd>
-<p>Random testing whith very short maximum line lengths produced some blinking states which were traced to the tokenizer alternately parsed an unknown bareword as type 'w' or type 'G', depending on whether or not an opening block brace immediately followed on the same line. To fix this, a rule was added which prevents a line break between a type 'G' token and an opening code block brace.</p>
+<p>Random testing with very short maximum line lengths produced some blinking states which were traced to the tokenizer alternately parsed an unknown bareword as type 'w' or type 'G', depending on whether or not an opening block brace immediately followed on the same line. To fix this, a rule was added which prevents a line break between a type 'G' token and an opening code block brace.</p>
<p>This update fixes these cases: b900 b902 b928 b929</p>
)
}</code></pre>
-<p>were occuring with the following particular parameter set</p>
+<p>were occurring with the following particular parameter set</p>
<pre><code> --weld-nested-containers
--maximum-line-length=40
--indent-columns=9
--continuation-indentation=1</code></pre>
-<p>The problem was that the token 'FILE' was either parsed as type 'Y' or 'Z' depending on the existance of a subsequent space. These have different line break rules, causing a blinker. The problem was fixed by modifying the tokenizer to consider a newline to be a space. Updated 16 Jan 2021, d40cca9.</p>
+<p>The problem was that the token 'FILE' was either parsed as type 'Y' or 'Z' depending on the existence of a subsequent space. These have different line break rules, causing a blinker. The problem was fixed by modifying the tokenizer to consider a newline to be a space. Updated 16 Jan 2021, d40cca9.</p>
</dd>
<dt id="Turn-off--bli-if--bar-is-set"><b>Turn off -bli if -bar is set</b></dt>
<dt id="Improve-rule-for-forgetting-last-side-comment-location"><b>Improve rule for forgetting last side comment location</b></dt>
<dd>
-<p>The code which aligns side comments remembers the most recent side comment and in some cases tries to start aligning at that column for later side comments. Sometimes the old side comment column was being remembered too long, causing occasional poor formatting and causing a noticable and unexpected drift of side comment locations to the right. The rule for forgetting the previous side comment column has been modified to reduce this problem. The new rule is essentially to forget the previous side comment location at a new side comment with different indentation level or significant number of lines without side comments (about 12). The previous implementation forgetting changes in indentation level across code blocks only. Below is an example where the old method gets into trouble and the new method is ok:</p>
+<p>The code which aligns side comments remembers the most recent side comment and in some cases tries to start aligning at that column for later side comments. Sometimes the old side comment column was being remembered too long, causing occasional poor formatting and causing a noticeable and unexpected drift of side comment locations to the right. The rule for forgetting the previous side comment column has been modified to reduce this problem. The new rule is essentially to forget the previous side comment location at a new side comment with different indentation level or significant number of lines without side comments (about 12). The previous implementation forgetting changes in indentation level across code blocks only. Below is an example where the old method gets into trouble and the new method is ok:</p>
<pre><code> # OLD:
foreach my $r (@$array) {
<dt id="Improve-vertical-alignment-in-some-marginal-matches"><b>Improve vertical alignment in some marginal matches</b></dt>
<dd>
-<p>In perltidy a 'marginal match' occurs for example when two lines share some alignment tokens but are somewhat different. When this happens some limits are placed on the size of the padding spaces that can be introduced. In this update the amount of allowed padding is significatly increased for certain 'good' alignment tokens. Results of extensive testing were favorable provided that the change is restricted to alignments of '=', 'if' and 'unless'. Update made 10 Dec 2020, a585f0b.</p>
+<p>In perltidy a 'marginal match' occurs for example when two lines share some alignment tokens but are somewhat different. When this happens some limits are placed on the size of the padding spaces that can be introduced. In this update the amount of allowed padding is significantly increased for certain 'good' alignment tokens. Results of extensive testing were favorable provided that the change is restricted to alignments of '=', 'if' and 'unless'. Update made 10 Dec 2020, a585f0b.</p>
<pre><code> # OLD
my @roles = $self->role_names;
}, on_exit => sub ( $worker, $status ) { return; },
);</code></pre>
-<p>Notice that the break after the comma has been lost. The problem was traced to a short-cut taken by the code looking for one-line blocks. The unique circumstances in which this occured involved a hash of anonymous subs, one with a signature with multiple parameters and short enough to be a one-line block, as in the last sub definition line. This was fixed 17 Oct 2020 in 'fix missing line break for hash of subs with signatures', 51428db.</p>
+<p>Notice that the break after the comma has been lost. The problem was traced to a short-cut taken by the code looking for one-line blocks. The unique circumstances in which this occurred involved a hash of anonymous subs, one with a signature with multiple parameters and short enough to be a one-line block, as in the last sub definition line. This was fixed 17 Oct 2020 in 'fix missing line break for hash of subs with signatures', 51428db.</p>
</dd>
<dt id="fix-issues-with-prototype-and-signature-parsing"><b>fix issues with prototype and signature parsing</b></dt>
<dt id="fix-incorrect-parsing-of-certain-deprecated-empty-here-docs"><b>fix incorrect parsing of certain deprecated empty here-docs </b></dt>
<dd>
-<p>The following snippet was being incorrecly parsed:</p>
+<p>The following snippet was being incorrectly parsed:</p>
<pre><code> print <<
# Hello World 13!
<dt id="crash-due-to-bad-index-named-j_terminal_match"><b>crash due to bad index named '$j_terminal_match'</b></dt>
<dd>
-<p>This crash was due to an index error which caused a non-existant object to be referenced. The problem is fixed 2020-09-07 in "fix problem of undefined values involving j_terminal_match", c5bfa77. The particular parameters which caused this were:</p>
+<p>This crash was due to an index error which caused a non-existent object to be referenced. The problem is fixed 2020-09-07 in "fix problem of undefined values involving j_terminal_match", c5bfa77. The particular parameters which caused this were:</p>
<pre><code> --noadd-newlines --nowant-left-space='=' </code></pre>
<pre><code> use Test::More;
ok open($stdin, "<&", $1), 'open ... "<&", $magical_fileno', || _diag $!;</code></pre>
-<p>Note the unusual situation of a comma followed by an '||'. Perltidy will format this satisfactorally but it will write an error message. The syntax is correct, however. Perl knows the prototype of the 'ok' function, which is called here without parens, so the last comma marks the last arg and is needed to keep the || from attaching to the last arg.</p>
+<p>Note the unusual situation of a comma followed by an '||'. Perltidy will format this satisfactorily but it will write an error message. The syntax is correct, however. Perl knows the prototype of the 'ok' function, which is called here without parens, so the last comma marks the last arg and is needed to keep the || from attaching to the last arg.</p>
<p>Full support of peren-less calls will probably never be implemented in perltidy because it would require that it parse all of the modules used to find the prototypes. This would make it impossible to run perltidy on small snippets of code from within an editor.</p>
<dt id="t---tabs"><b>-t</b>, <b>--tabs</b></dt>
<dd>
-<p>This flag causes one leading tab character to be inserted for each level of indentation. Certain other features are incompatible with this option, and if these options are also given, then a warning message will be issued and this flag will be unset. One example is the <b>-lp</b> option. This flag is retained for backwards compatability, but if you use tabs, the <b>-et=n</b> flag is recommended.</p>
+<p>This flag causes one leading tab character to be inserted for each level of indentation. Certain other features are incompatible with this option, and if these options are also given, then a warning message will be issued and this flag will be unset. One example is the <b>-lp</b> option. This flag is retained for backwards compatibility, but if you use tabs, the <b>-et=n</b> flag is recommended.</p>
</dd>
<dt id="dt-n---default-tabsize-n"><b>-dt=n</b>, <b>--default-tabsize=n</b></dt>
<dt id="xci---extended-continuation-indentation"><b>-xci</b>, <b>--extended-continuation-indentation</b></dt>
<dd>
-<p>This flag allows perltidy to use some improvements which have been made to its indentation model. One of the things it does is "extend" continuation indentation deeper into structures, hence the name. The improved indentation is particularly noticable when the flags <b>-ci=n</b> and <b>-i=n</b> use the same value of <b>n</b>. There are no significant disadvantages to using this flag, but to avoid disturbing existing formatting the default is not to use it, <b>-nxci</b>.</p>
+<p>This flag allows perltidy to use some improvements which have been made to its indentation model. One of the things it does is "extend" continuation indentation deeper into structures, hence the name. The improved indentation is particularly noticeable when the flags <b>-ci=n</b> and <b>-i=n</b> use the same value of <b>n</b>. There are no significant disadvantages to using this flag, but to avoid disturbing existing formatting the default is not to use it, <b>-nxci</b>.</p>
<p>Please see the section <a href="#pbp---perl-best-practices">"<b>-pbp</b>, <b>--perl-best-practices</b>"</a> for an example of how this flag can improve the formatting of ternary statements. It can also improve indentation of some multi-line qw lists as shown below.</p>
<pre><code> -lpxl='[ {'</code></pre>
-<p>means do <b>NOT</b> include use -lp formatting within square-bracets or braces. The only unspecified container is '(', so this string means that only the contens within parens will use -lp indentation.</p>
+<p>means do <b>NOT</b> include use -lp formatting within square-bracets or braces. The only unspecified container is '(', so this string means that only the contents within parens will use -lp indentation.</p>
<p>An optional numeric code may follow any of the container types to further refine the selection based on container contents. The numeric codes are:</p>
<dt id="Note2:-Perltidys-whitespace-rules-are-not-perfect"><b>Note2: Perltidy's whitespace rules are not perfect</b></dt>
<dd>
-<p>Despite these precautions, it is still possible to introduce syntax errors with some asymmetric whitespace rules, particularly when call parameters are not placed in containg parens or braces. For example, the following two lines will be parsed by perl without a syntax error:</p>
+<p>Despite these precautions, it is still possible to introduce syntax errors with some asymmetric whitespace rules, particularly when call parameters are not placed in containing parens or braces. For example, the following two lines will be parsed by perl without a syntax error:</p>
<pre><code> # original programming, syntax ok
my @newkeys = map $_-$nrecs+@data, @oldkeys;
# sub cxt_two { sort { $a <=> $b } test_if_list() }
# The 'sort' block is short and nested within an outer sub block.
- # Normally, the existance of the 'sort' block will force the sub block to
+ # Normally, the existence of the 'sort' block will force the sub block to
# break open, but this is not always desirable. Here we will set a flag for
# the sort block to prevent this. To give the user control, we will
# follow the input file formatting. If either of the blocks is broken in
# -bbxi=2 ...
#################################################################
- # Part 2: Perform tests before commiting to changing ci and level
+ # Part 2: Perform tests before committing to changing ci and level
#################################################################
# Before changing the ci level of the opening container, we need
# Add one token to the next batch.
# $Ktoken_vars = the index K in the global token array
# $rtoken_vars = $rLL->[$Ktoken_vars] = the corresponding token values
- # unless they are temporarily being overriden
+ # unless they are temporarily being overridden
# NOTE: This routine needs to be coded efficiently because it is called
# once per token. I have gotten it down from the second slowest to the
# Check correctness of the mapping between the i and K token
# indexes. (The K index is the global index, the i index is the
# batch index). It is important to do this check because an error
- # would be disasterous. The reason that we should never see an
+ # would be disastrous. The reason that we should never see an
# index error here is that sub 'store_token_to_go' has a check to
# make sure that the indexes in batches remain continuous. Since
# sub 'store_token_to_go' controls feeding tokens into batches, so
$in_attribute_list = 1;
}
- # Withing a signature, unless we are in a ternary. For example,
+ # Within a signature, unless we are in a ternary. For example,
# from 't/filter_example.t':
# method foo4 ( $class: $bar ) { $class->bar($bar) }
elsif ( $paren_type[$paren_depth] =~ /^sub\b/
|([0-7_]+ # string of octal digits
(\.([0-7][0-7_]*)?)? # optional decimal and fraction
[Pp][+-]?[0-7] # REQUIRED exponent, no underscore
- [0-7_]*) # Additonal exponent digits, with underscores
+ [0-7_]*) # Additional exponent digits, with underscores
# or octal integer
|([0-7_]+) # string of octal digits
Testing produced a blinking state involving a -bbx=2 flag with an unusual
combination of other parameters. The problem was traced to the definition of a
-list containg another list being too restrictive. This update fixes case
+list containing another list being too restrictive. This update fixes case
1024.
17 Mar 2021, 7f5da0a.
=item B<Fix issue git#54 involving -bbp=n and -bbpi=n>
-In this issue, different results were obtained depending upon the existance of
+In this issue, different results were obtained depending upon the existence of
a comma in a list. To fix this, the definition of a list was adjusted from
requiring one or more commas to requiring either a fat comma or a comma.
paren in the following case.
# perltidy -gnu
- ok( "got to the end without dieing (note without DEBUGGING passing this test means nothing)"
+ ok( "got to the end without dying (note without DEBUGGING passing this test means nothing)"
);
26 Feb 2021, 2b88464.
=item B<Avoid line breaks after token type 'G'>
-Random testing whith very short maximum line lengths produced some blinking
+Random testing with very short maximum line lengths produced some blinking
states which were traced to the tokenizer alternately parsed an unknown
bareword as type 'w' or type 'G', depending on whether or not an opening block
brace immediately followed on the same line. To fix this, a rule was added
)
}
-were occuring with the following particular parameter set
+were occurring with the following particular parameter set
--weld-nested-containers
--maximum-line-length=40
--continuation-indentation=1
The problem was that the token 'FILE' was either parsed as type 'Y'
-or 'Z' depending on the existance of a subsequent space. These have
+or 'Z' depending on the existence of a subsequent space. These have
different line break rules, causing a blinker. The problem was
fixed by modifying the tokenizer to consider a newline to be a space.
Updated 16 Jan 2021, d40cca9.
The code which aligns side comments remembers the most recent side comment and
in some cases tries to start aligning at that column for later side comments.
Sometimes the old side comment column was being remembered too long, causing
-occasional poor formatting and causing a noticable and unexpected drift of side
+occasional poor formatting and causing a noticeable and unexpected drift of side
comment locations to the right. The rule for forgetting the previous side
comment column has been modified to reduce this problem. The new rule is
essentially to forget the previous side comment location at a new side comment
In perltidy a 'marginal match' occurs for example when two lines share some
alignment tokens but are somewhat different. When this happens some limits are
placed on the size of the padding spaces that can be introduced. In this
-update the amount of allowed padding is significatly increased for certain
+update the amount of allowed padding is significantly increased for certain
'good' alignment tokens. Results of extensive testing were favorable provided
that the change is restricted to alignments of '=', 'if' and 'unless'. Update
made 10 Dec 2020, a585f0b.
Notice that the break after the comma has been lost. The problem was traced to
a short-cut taken by the code looking for one-line blocks. The unique
-circumstances in which this occured involved a hash of anonymous subs, one with
+circumstances in which this occurred involved a hash of anonymous subs, one with
a signature with multiple parameters and short enough to be a one-line block,
as in the last sub definition line. This was fixed 17 Oct 2020
in 'fix missing line break for hash of subs with signatures', 51428db.
=item B<fix incorrect parsing of certain deprecated empty here-docs >
-The following snippet was being incorrecly parsed:
+The following snippet was being incorrectly parsed:
print <<
# Hello World 13!
=item B<crash due to bad index named '$j_terminal_match'>
-This crash was due to an index error which caused a non-existant object to be
+This crash was due to an index error which caused a non-existent object to be
referenced. The problem is fixed 2020-09-07 in "fix problem of undefined values involving j_terminal_match",
c5bfa77. The particular parameters which caused this were:
ok open($stdin, "<&", $1), 'open ... "<&", $magical_fileno', || _diag $!;
Note the unusual situation of a comma followed by an '||'. Perltidy will format this
-satisfactorally but it will write an error message. The syntax is correct, however.
+satisfactorily but it will write an error message. The syntax is correct, however.
Perl knows the prototype of the 'ok' function, which is called here without parens,
so the last comma marks the last arg and is needed to keep the || from attaching
to the last arg.
-# marginal two-line match; differnt lhs patterns; do not align
+# marginal two-line match; different lhs patterns; do not align
$w[$i] = $t;
$t = 1000000;
-# Do not align interior fat commas here; differnt container types
+# Do not align interior fat commas here; different container types
my $p = TAP::Parser::SubclassTest->new(
{
exec => [ $cat => $file ],
-# marginal two-line match; differnt lhs patterns; do not align
+# marginal two-line match; different lhs patterns; do not align
$w[$i] = $t;
$t = 1000000;
-# Do not align interior fat commas here; differnt container types
+# Do not align interior fat commas here; different container types
my $p = TAP::Parser::SubclassTest->new(
{
exec => [ $cat => $file ],
}
# use the first part of the actual string because we have
- # turned all commas, etc into spaces for testing lenghts
+ # turned all commas, etc into spaces for testing lengths
$short = substr( $long, 0, length($short) ) . "...";
}
return ($short);
use strict;
my @files = @ARGV;
my %saw;
-# Look at a number of .pro profiles and show ther common flags.
+# Look at a number of .pro profiles and show their common flags.
# This can help pinpoint the flags which are causing an issue.
foreach my $file (@files) {
open( IN, "<", $file ) || die "cannot open $file: $!\n";
----------
'align20' => <<'----------',
-# marginal two-line match; differnt lhs patterns; do not align
+# marginal two-line match; different lhs patterns; do not align
$w[$i] = $t;
$t = 1000000;
----------
----------
'align24' => <<'----------',
-# Do not align interior fat commas here; differnt container types
+# Do not align interior fat commas here; different container types
my $p = TAP::Parser::SubclassTest->new(
{
exec => [ $cat => $file ],
source => "align20",
params => "def",
expect => <<'#12...........',
-# marginal two-line match; differnt lhs patterns; do not align
+# marginal two-line match; different lhs patterns; do not align
$w[$i] = $t;
$t = 1000000;
#12...........
source => "align24",
params => "def",
expect => <<'#16...........',
-# Do not align interior fat commas here; differnt container types
+# Do not align interior fat commas here; different container types
my $p = TAP::Parser::SubclassTest->new(
{
exec => [ $cat => $file ],