Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 85938
Status: new
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: buys444 [...] gmail.com
Cc:
AdminCc:

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



Subject: Possible Bug in Perl::Critic::Policy::Subroutines::RequireFinalReturn
Date: Thu, 6 Jun 2013 16:19:56 -0400
To: bug-Perl-Critic [...] rt.cpan.org
From: Zachary Fletcher <buys444 [...] gmail.com>
Download (untitled) / with headers
text/plain 518b
Hi! I found a bug in Perl::Critic::Policy::Subroutines::RequireFinalReturn in revision 4126. When I try to validate the following code "sub foo { if @a { return } }" I get an error (that is perl ciritic crashes instead of telling me I'm doing something stupid). I'm not a perl expert and I'm using a version of perl critic called from a complicated wrapper someone wrote years ago, so the problem could be there as well. I thought I would point it out in case it was a bug so that it could be looked into. Thanks
Subject: Re: [rt.cpan.org #85938] Possible Bug in Perl::Critic::Policy::Subroutines::RequireFinalReturn
Date: Thu, 6 Jun 2013 14:29:16 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Jeffrey Ryan Thalhammer <jeff [...] imaginative-software.com>
Download (untitled) / with headers
text/plain 843b
On Jun 6, 2013, at 1:20 PM, Zachary Fletcher via RT wrote: Show quoted text
> When I try to validate the following code "sub foo { if @a { return } }" I > get an error (that is perl ciritic crashes instead of telling me I'm doing > something stupid).
That expression is not syntactically valid perl: $> perl -c -e 'sub foo { if @a { return } }' syntax error at -e line 1, near "if @a " syntax error at -e line 1, near "} }" -e had compilation errors. This is probably what you mean: sub foo { if (@a) { return }} Unfortunately, Perl::Critic can't promise to do anything sane with code that is not syntactically valid. And since Perl::Critic is purely a static analyzer, it can't check the syntax for you. So if you see mysterious errors from Perl::Critic, running `perl -c` over your code is a good first step to diagnose. Hope that helps! -Jeff
Download (untitled) / with headers
text/plain 1.2k
On Thu Jun 06 16:20:30 2013, buys444@gmail.com wrote: Show quoted text
> Hi! > > I found a bug in Perl::Critic::Policy::Subroutines::RequireFinalReturn in > revision 4126. > > When I try to validate the following code "sub foo { if @a { return } }" I > get an error (that is perl ciritic crashes instead of telling me I'm doing > something stupid). > > I'm not a perl expert and I'm using a version of perl critic called from a > complicated wrapper someone wrote years ago, so the problem could be there > as well. > > I thought I would point it out in case it was a bug so that it could be > looked into. > > Thanks
The good news is that I have reproduced your failure and the stack trace makes it look to me like a Perl::Critic error rather than a PPI error. The bad news is that since the failing code does not compile (at least under any Perl easily available to me, and I tried back to 5.8.1) this is probably not going to get a very high priority. When I tried I got $ perl sub foo { if @a { return } } ^D syntax error at - line 1, near "if @a " syntax error at - line 1, near "} }" Execution of - aborted due to compilation errors. Hint: you need parentheses around the "@a". Well, maybe not with Perl 6, but Perl::Critic does not support this.


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.