Skip Menu |

This queue is for tickets about the Perl-Tidy CPAN distribution.

Report information
The Basics
Id: 124605
Status: resolved
Priority: 0/
Queue: Perl-Tidy

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 20180219
Fixed in: (no value)



Subject: -fnl inserts semicolon before a curly bracket
With Perl-Tidy-20180101: $ printf 'if (foo) {\nbar\n}' | perltidy -fnl if (foo) { bar } With Perl-Tidy-20180220: $ printf 'if (foo) {\nbar\n}' | perltidy -fnl if (foo) { bar; } Adding -nasc helps. Is this change intentional?
Subject: Re: [rt.cpan.org #124605] -fnl inserts semicolon before a curly bracket
Date: Tue, 27 Feb 2018 06:33:28 -0800
To: bug-Perl-Tidy [...] rt.cpan.org
From: Steven Hancock <s7078hancock [...] gmail.com>
Yes, there was a change to the semicolon coding to make it more closely follow the intention of the flag. The control for this is -asc, which is the default: -asc, --add-semicolons Setting -asc allows perltidy to add any missing optional semicolon at the end of a line which is followed by a closing curly brace on the next line. This is the default, and may be deactivated with -nasc or --noadd-semicolons So this is what happens in your example. The coding change which was made was to change the meaning of "next line" in this text to be "next line of code". The previous version would have given the same result as the latest version if you had put a newline at the end of your test snippet. The previous version would add a semicolon for this snippet: if (foo) { bar } but not for this snippet: if (foo) { bar } because of the blank line. The current version will add the semicolon in both cases. Using -nasc is the way to avoid adding semicolons. I am thinking about adding some more refined semicolon controls in the future. Steve On Tue, Feb 27, 2018 at 3:54 AM, Petr Pisar via RT < bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Tue Feb 27 06:54:49 2018: Request 124605 was acted upon. > Transaction: Ticket created by ppisar > Queue: Perl-Tidy > Subject: -fnl inserts semicolon before a curly bracket > Broken in: 20180219 > Severity: (no value) > Owner: Nobody > Requestors: ppisar@redhat.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=124605 > > > > With Perl-Tidy-20180101: > > $ printf 'if (foo) {\nbar\n}' | perltidy -fnl > if (foo) { > bar > } > > With Perl-Tidy-20180220: > > $ printf 'if (foo) {\nbar\n}' | perltidy -fnl > > if (foo) { > bar; > } > > Adding -nasc helps. Is this change intentional? >
Subject: Re: [rt.cpan.org #124605] -fnl inserts semicolon before a curly bracket
Date: Tue, 27 Feb 2018 06:43:05 -0800
To: bug-Perl-Tidy [...] rt.cpan.org
From: Steven Hancock <s7078hancock [...] gmail.com>
Sorry, I see I didn't completely answer your question. The -fnl flag is supposed to just keep the same line breaks but doesn't control semicolon addition, since they do not change line breaks. So as part of correcting the semicolon control logic the semicolons are now being added, which I think is how it should be. Steve On Tue, Feb 27, 2018 at 6:33 AM, Steven Hancock <s7078hancock@gmail.com> wrote: Show quoted text
> Yes, there was a change to the semicolon coding to make it more closely > follow the intention of the flag. > The control for this is -asc, which is the default: > > -asc, --add-semicolons > Setting -asc allows perltidy to add any missing optional > semicolon at the end of a line > which is followed by a closing curly brace on the next line. > This is the default, and > may be deactivated with -nasc or --noadd-semicolons > > So this is what happens in your example. The coding change which was made > was to change the > meaning of "next line" in this text to be "next line of code". The > previous version would have given the same result as > the latest version if you had put a newline at the end of your test > snippet. > > The previous version would add a semicolon for this snippet: > if (foo) { > bar > } > > but not for this snippet: > > if (foo) { > bar > > } > > because of the blank line. The current version will add the semicolon in > both cases. > > > Using -nasc is the way to avoid adding semicolons. > > I am thinking about adding some more refined semicolon controls in the > future. > Steve > > On Tue, Feb 27, 2018 at 3:54 AM, Petr Pisar via RT < > bug-Perl-Tidy@rt.cpan.org> wrote: >
>> Tue Feb 27 06:54:49 2018: Request 124605 was acted upon. >> Transaction: Ticket created by ppisar >> Queue: Perl-Tidy >> Subject: -fnl inserts semicolon before a curly bracket >> Broken in: 20180219 >> Severity: (no value) >> Owner: Nobody >> Requestors: ppisar@redhat.com >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=124605 > >> >> >> With Perl-Tidy-20180101: >> >> $ printf 'if (foo) {\nbar\n}' | perltidy -fnl >> if (foo) { >> bar >> } >> >> With Perl-Tidy-20180220: >> >> $ printf 'if (foo) {\nbar\n}' | perltidy -fnl >> >> if (foo) { >> bar; >> } >> >> Adding -nasc helps. Is this change intentional? >>
> >
Subject: Re: [rt.cpan.org #124605] -fnl inserts semicolon before a curly bracket
Date: Tue, 27 Feb 2018 17:03:19 +0100
To: Steven Hancock via RT <bug-Perl-Tidy [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
On Tue, Feb 27, 2018 at 09:43:17AM -0500, Steven Hancock via RT wrote: Show quoted text
> The -fnl flag is supposed to just keep the same line breaks but doesn't > control semicolon addition, since they do not change line breaks. So as > part of correcting the semicolon control logic the semicolons are now being > added, which I think is how it should be. >
Thank you for the explanation. I will report it to Mason-Tidy maintainer <https://rt.cpan.org/Public/Bug/Display.html?id=124604>. -- Petr
perltidy version 20181117 has been released. I think this issue does not require any action and can be closed.