Skip Menu |

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

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

People
Owner: perltidy [...] users.sourceforge.net
Requestors: PackyAnderson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 20160302
Fixed in: (no value)



Subject: Using // breaks vertical alignment of = for two lines
Given the code: sub demo { my $self = shift; my $longname = shift // "xyz"; } The tidied version SHOULD be: sub demoA { my $self = shift; my $longname = shift // "xyz"; } But the current version of perltidy doesn't add the extra spaces after $self to align the equal signs unless there's a third assignment. I'm attaching a file that shows the bug, the bug being worked around by putting the // in a separate statement, and the bug not manifesting when there are three consecutive assignments, after being run through perltidy -npro -b bug.pl. The file also has the output of perltidy -npro -b -dop so you can see what's enabled and what's not. perl v5.24.0 Darwin kirby.home.packay.com 15.6.0 Darwin Kernel Version 15.6.0: Thu Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64 x86_64
Subject: bug.pl
sub demoA { my $self = shift; my $longname = shift // "xyz"; } sub demoB { my $self = shift; my $longname = shift; $longname //= "xyz"; } sub demoC { my $self = shift; my $longname = shift // "xyz"; my $evenlongername = shift; } __END__ $ perltidy -npro -b -dop # Final parameter set for this run. # See utility 'perltidyrc_dump.pl' for nicer formatting. --add-newlines --add-semicolons --add-whitespace --backup-and-modify-in-place --backup-file-extension="bak" --blank-lines-before-packages=1 --blank-lines-before-subs=1 --blanks-before-blocks --blanks-before-comments --block-brace-tightness=0 --block-brace-vertical-tightness=0 --nobrace-left-and-indent --brace-tightness=1 --brace-vertical-tightness=0 --brace-vertical-tightness-closing=0 --break-at-old-attribute-breakpoints --break-at-old-keyword-breakpoints --break-at-old-logical-breakpoints --break-at-old-ternary-breakpoints --character-encoding="none" --nocheck-syntax --closing-brace-indentation=0 --closing-paren-indentation=0 --closing-side-comment-else-flag=0 --closing-side-comment-interval=6 --closing-side-comment-maximum-text=20 --closing-side-comments-balanced --closing-square-bracket-indentation=0 --comma-arrow-breakpoints=5 --continuation-indentation=2 --nocuddled-else --default-tabsize=8 --delete-old-newlines --nodelete-old-whitespace --delete-semicolons --dump-options --extended-syntax --format="tidy" --format-skipping --fuzzy-line-length --hanging-side-comments --nohtml --html-entities --html-table-of-contents --indent-block-comments --indent-columns=4 --iterations=1 --keep-old-blank-lines=1 --nologfile --long-block-line-count=8 --look-for-autoloader --look-for-selfloader --maximum-consecutive-blank-lines=1 --maximum-fields-per-table=0 --maximum-line-length=80 --memoize --minimum-space-to-comment=4 --npro --outdent-labels --outdent-long-comments --outdent-long-quotes --paren-tightness=1 --paren-vertical-tightness=0 --paren-vertical-tightness-closing=0 --pass-version-line --perl-syntax-check-flags="-c -T" --pod2html --noquiet --recombine --short-concatenation-item-length=8 --noshow-options --space-for-semicolon --square-bracket-tightness=1 --square-bracket-vertical-tightness=0 --square-bracket-vertical-tightness-closing=0 --static-block-comments --nostatic-side-comments --notabs --trim-qw --valign --nowarning-output
Subject: Re: [rt.cpan.org #119588] Using // breaks vertical alignment of = for two lines
Date: Sat, 31 Dec 2016 17:20:07 -0800
To: "bug-Perl-Tidy [...] rt.cpan.org" <bug-Perl-Tidy [...] rt.cpan.org>
From: Steven Hancock <perltidy [...] users.sourceforge.net>
Thanks for the report. What's going on is that perltidy has some special rules which reject many possible two-line alignments because they frequently look much worse with alignment than without. But in this case it would look okay, so I'll see if I can adjust the rules. Steve On Fri, Dec 30, 2016 at 1:44 AM, Packy Anderson via RT < bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Fri Dec 30 04:44:38 2016: Request 119588 was acted upon. > Transaction: Ticket created by packy > Queue: Perl-Tidy > Subject: Using // breaks vertical alignment of = for two lines > Broken in: 20160302 > Severity: Normal > Owner: SHANCOCK > Requestors: PackyAnderson@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=119588 > > > > Given the code: > sub demo { > my $self = shift; > my $longname = shift // "xyz"; > } > > The tidied version SHOULD be: > sub demoA { > my $self = shift; > my $longname = shift // "xyz"; > } > > But the current version of perltidy doesn't add the extra spaces after > $self to align the equal signs unless there's a third assignment. I'm > attaching a file that shows the bug, the bug being worked around by putting > the // in a separate statement, and the bug not manifesting when there are > three consecutive assignments, after being run through perltidy -npro -b > bug.pl. The file also has the output of perltidy -npro -b -dop so you > can see what's enabled and what's not. > > perl v5.24.0 > Darwin kirby.home.packay.com 15.6.0 Darwin Kernel Version 15.6.0: Thu > Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64 x86_64 >
This is fixed in version 20171214
Le Jeu 14 Déc 2017 15:51:40, SHANCOCK a écrit : Show quoted text
> This is fixed in version 20171214
Mmmm So, I had this code: my $color = $opts{'-color'} // 'black'; my $background = $opts{'-background'} // 'none'; my $linewidth = $opts{'-linewidth'} // 1; my $radius = $opts{'-radius'} // 0; which was nicely tightly aligned, and now, it is no longer : my $color = $opts{'-color'} // 'black'; my $background = $opts{'-background'} // 'none'; my $linewidth = $opts{'-linewidth'} // 1; my $radius = $opts{'-radius'} // 0;
Subject: Re: [rt.cpan.org #119588] Using // breaks vertical alignment of = for two lines
Date: Sat, 21 Apr 2018 18:33:08 -0700
To: bug-Perl-Tidy [...] rt.cpan.org
From: Steven Hancock <s7078hancock [...] gmail.com>
Alignment of // operators is no longer being done because it can interfere with other alignments. Steve On Fri, Apr 20, 2018 at 6:31 AM, Mathieu Arnold via RT < bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> Queue: Perl-Tidy > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=119588 > > > Le Jeu 14 Déc 2017 15:51:40, SHANCOCK a écrit :
> > This is fixed in version 20171214
> > Mmmm > > So, I had this code: > > my $color = $opts{'-color'} // 'black'; > my $background = $opts{'-background'} // 'none'; > my $linewidth = $opts{'-linewidth'} // 1; > my $radius = $opts{'-radius'} // 0; > > which was nicely tightly aligned, and now, it is no longer : > > my $color = $opts{'-color'} // 'black'; > my $background = $opts{'-background'} // 'none'; > my $linewidth = $opts{'-linewidth'} // 1; > my $radius = $opts{'-radius'} // 0; > >