the limit to 20 MB for example would be -mfs=20. This only applies to
files specified by filename on the command line.
- - Skip formatting if too many indentation level errors. This is controlled
- with -maxle=n, --maximum-level-errors=n. This means that if the ending
- indentation differs from the starting indentation by more than
+ - Skip formatting if there are too many indentation level errors. This is
+ controlled with -maxle=n, --maximum-level-errors=n. This means that if
+ the ending indentation differs from the starting indentation by more than
n levels, the file will be output verbatim. The default is n=1.
To skip this check, set n=0.
- - Skip formatting if too many 'unexpected' tokenization errors. This is controlled
- with -maxue=n, --maximum-unexpected-errors=n. This means that if the
- number of times the tokenizer found unexpected tokens is greater than n,
- the file will be output verbatim. The intention is to avoid formatting
- non-perl scripts. The default is n=3. To skip this check, set n=0.
- It is possible that some extended syntaxes will require setting
- -maxue=0. It would be better to try to work out a patch to perltidy to handle
- such cases.
-
- Add flag -xci, --extended-continuation-indentation, regarding issue git #28
This flag causes continuation indentation to "extend" deeper into structures.
Since this is a fairly new flag, the default is -nxci to avoid disturbing
indentation level errors are allowed before perltidy skips formatting and just
outputs a file verbatim. The default is n=1. This means that if the final indentation
of a script differs from the starting indentation by more than 1 levels, the file
-will be output verbatim. To skip this check completely, set n=0.
+will be output verbatim. To avoid formatting if there are any indentation
+level errors use -maxle=0. To skip this check set n equal to a large number,
+such as n=100.
For example, the following script has level error of 3 and will be output verbatim
{{{
- perltidy -maxle=0
+ perltidy -maxle=100
{
{
{
B<--maximum-unexpected-errors=n> or B<-maxue=n> specifies the maximum number of
unexpected tokenization errors are allowed before formatting is skipped and a
-script is output verbatim. The intention of this flag is to avoid accidentally
-formatting something like an html file, for example. The default is n=3. This
-means that if the number of times the tokenizer found unexpected tokens is
-greater than 3, the file will be output verbatim. To skip this check
-completely, set n=0.
-
-It is possible that some extended syntaxes will require setting -maxue=0. It
-would be better to try to work out a patch to perltidy to handle such cases
-cleanly so that the tokenizer is not left in an uncertain state.
+script is output verbatim. This is off by default but can be turned on to
+avoid accidentally formatting something like an html file, for example. If the
+number of times the tokenizer found unexpected tokens is greater than the
+parameter n, the file will be output verbatim. To skip this check completely,
+set n equal to a large number or set n=0. The default is n=0 (skip this check)
+to avoid causing problems with scripts using extended syntaxes.
B<-DEBUG> will write a file with extension F<.DEBUG> for each input file
showing the tokenization of all lines of code.
maximum-line-length=80
maximum-file-size-mb=10
maximum-level-errors=1
- maximum-unexpected-errors=3
+ maximum-unexpected-errors=0
memoize
minimum-space-to-comment=4
nobrace-left-and-indent
my $maxle = $self->[_rOpts_maximum_level_errors_];
my $maxue = $self->[_rOpts_maximum_unexpected_errors_];
$maxle = 1 unless defined($maxle);
- $maxue = 3 unless defined($maxue);
+ $maxue = 0 unless defined($maxue);
my $level = get_indentation_level();
if ( $level != $tokenizer_self->[_starting_level_] ) {
# Set severe error flag if the level error is greater than 1.
# The formatter can function for any level error but it is probably
# best not to attempt formatting for a high level error.
- if ( $maxle > 0 && $level_diff > $maxle ) {
+ if ( $level_diff > $maxle ) {
$severe_error = 1;
warning(<<EOM);
Formatting will be skipped because level error '$level_diff' exceeds -maxle=$maxle; use -maxle=0 to force formatting
# Multiple "unexpected" type tokenization errors usually indicate parsing
# non-perl scripts, or that something is seriously wrong, so we should
# avoid formatting them. This can happen for example if we run perltidy on
- # a shell script or an html file.
+ # a shell script or an html file. But unfortunately this check can
+ # interfere with some extended syntaxes, such as RPerl, so it has to be off
+ # by default.
my $ue_count = $tokenizer_self->[_unexpected_error_count_];
if ( $maxue > 0 && $ue_count > $maxue ) {
warning(<<EOM);