Skip Menu |
 

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

Report information
The Basics
Id: 119588
Status: open
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
Download (untitled) / with headers
text/plain 853b
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
Download bug.pl
text/x-perl 2.3k
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>
Download (untitled) / with headers
text/plain 1.6k
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 service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.