Skip Menu |

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

Report information
The Basics
Id: 124604
Status: new
Priority: 0/
Queue: Mason-Tidy

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

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



Subject: t/CLI.t test fails with perltidy ≥ 20180219
After upgrading perltidy to 20180219 or newer, t/CLI.t fails like this: t/Basic.t ... ok # Failed test 'no options' # at /builddir/build/BUILD/Mason-Tidy-2.57/blib/lib/Mason/Tidy/t/CLI.pm line 44. # (in Mason::Tidy::t::CLI->test_cli) # got: '% if (foo) { # % bar; # % } # ' # expected: '% if (foo) { # % bar # % } # ' # Failed test 'no options' # at /builddir/build/BUILD/Mason-Tidy-2.57/blib/lib/Mason/Tidy/t/CLI.pm line 46. # (in Mason::Tidy::t::CLI->test_cli) # got: '% if (foo) { # % bar; # % } # ' # expected: '% if (foo) { # % bar # % } # ' # Looks like you failed 2 tests of 16. t/CLI.t ..... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/16 subtests
From: ppisar [...] redhat.com
This can be reduced to: With perltidy-20180101: $ printf 'if (foo) {\nbar\n}' | perltidy -fnl if (foo) { bar } With perltidy-20180220: $ printf 'if (foo) {\nbar\n}' | perltidy -fnl if (foo) { bar; } Probably you want to call perltidy with -nasc that prevents from adding the semicolon after last statement of a block: -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.
From: ppisar [...] redhat.com
Dne Út 27.úno.2018 06:45:45, ppisar napsal(a): Show quoted text
> This can be reduced to: > > With perltidy-20180101: > > $ printf 'if (foo) {\nbar\n}' | perltidy -fnl > if (foo) { > bar > } >
I asked Perl-Tidy author <https://rt.cpan.org/Public/Bug/Display.html?id=124605>.
From: ppisar [...] redhat.com
Dne Út 27.úno.2018 06:55:19, ppisar napsal(a): Show quoted text
> Dne Út 27.úno.2018 06:45:45, ppisar napsal(a):
> > This can be reduced to: > > > > With perltidy-20180101: > > > > $ printf 'if (foo) {\nbar\n}' | perltidy -fnl > > if (foo) { > > bar > > } > >
> I asked Perl-Tidy author > <https://rt.cpan.org/Public/Bug/Display.html?id=124605>.
Perl-Tidy author says the new behavior is correct.
From: ppisar [...] redhat.com
Dne Út 27.úno.2018 10:59:54, ppisar napsal(a): Show quoted text
> Perl-Tidy author says the new behavior is correct.
Attached patch corrects Mason-Tidy code to request not adding the semicolon.
Subject: Mason-Tidy-2.57-Adapt-to-changes-in-Perl-Tidy-20180219.patch
From ec0b4db5046f56f1f5c8e68523e464ce28d6e377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Tue, 27 Feb 2018 17:34:10 +0100 Subject: [PATCH] Adapt to changes in Perl-Tidy-20180219 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl-Tidy-20180219 corrected inserting semicolons after a last statement of a block. That break Mason-Tidy CLI.t tests like this: # Failed test 'no options' # at /builddir/build/BUILD/Mason-Tidy-2.57/blib/lib/Mason/Tidy/t/CLI.pm line 44. # (in Mason::Tidy::t::CLI->test_cli) # got: '% if (foo) { # % bar; # % } # ' # expected: '% if (foo) { # % bar # % } # ' This patch makes sure the simicolon is not inserted. CPAN RT#124604 Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/Mason/Tidy.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Mason/Tidy.pm b/lib/Mason/Tidy.pm index 0cdc7d2..4b60076 100644 --- a/lib/Mason/Tidy.pm +++ b/lib/Mason/Tidy.pm @@ -158,7 +158,7 @@ method tidy_method ($source) { $self->perltidy( source => \$untidied_perl, destination => \my $tidied_perl, - argv => $self->perltidy_line_argv . " -fnl -fbl", + argv => $self->perltidy_line_argv . " -fnl -fbl -nasc ", ); $tidied_perl =~ s/^{\n//; $tidied_perl =~ s/}\n$//; -- 2.13.6