Subject: | perltidy incorrectly assumes 'case' is special |
Date: | Tue, 6 May 2014 15:10:40 -0700 |
To: | bug-Perl-Tidy [...] rt.cpan.org |
From: | Chad Granum <chad.granum [...] dreamhost.com> |
case is not a resevred keyword in perl. It is not special in any-way unless
you use features/modules that enable it. Perltidy should treat it like it
would any other function.
This bug came up in a Fennec unit test where 'case' is an exported function.
Sample:
case "blah" => sub { {a => 1} };
Gets tidied to:
case "blah" => sub {
{
a => 1;
}
};
Which is a syntax error with that extra semicolon.
Tidyrc used:
--indent-columns=4 # size of indentation
--nt # no tabs
--continuation-indentation=4 # indentation of wrapped lines
--maximum-line-length=0 # max line length before wrapping
(turn it off)
--nooutdent-long-quotes # do not outdent overly long quotes
--paren-tightness=2 # no spacing for parentheses
--square-bracket-tightness=2 # no spacing for square brackets
--brace-tightness=2 # no spacing for hash curly braces
--block-brace-tightness=0 # spacing for coderef curly braces
--comma-arrow-breakpoints=1 # break long key/value pair lists
--break-at-old-comma-breakpoints # this attempts to retain list break
points
--no-blanks-before-comments # do not insert blank lines before
comments
--indent-spaced-block-comments # no blanks before comments
--nocuddled-else # Do not cuddle else
--nospace-for-semicolon # no space before semicolons in loops
--nospace-terminal-semicolon # no space before termonal semicolons
--notrim-qw # Do not mess with qw{} whitespace