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: 48033
Status: open
Priority: 0/
Queue: Perl-Critic

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

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



Subject: False positive for ValuesAndExpressions::ProhibitCommaSeparatedStatements
Date: Mon, 20 Jul 2009 17:41:07 -0400
To: bug-Perl-Critic [...] rt.cpan.org
From: Packy Anderson <packyanderson [...] gmail.com>
I've found another false positive: package main; use strict; use warnings; sub func {} my %hash; func( { %hash, bar => 2 } ); 1; Because the direct parent of the code containing the comma parses out to be a PPI::Structure::Block, it's mistakenly flagging the hashref as violating this policy. I've actually worked up a patch that I think fixes this, but I wanted to open a ticket for it first so I could reference it in my patch to the ProhibitCommaSeparatedStatements.run file. Thanks, -packy -- Packy Anderson Email: PackyAnderson@gmail.com
Subject: Re: [rt.cpan.org #48033] False positive for ValuesAndExpressions::ProhibitCommaSeparatedStatements
Date: Mon, 20 Jul 2009 14:59:57 -0700
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Packy Anderson via RT wrote: Show quoted text
> Because the direct parent of the code containing the comma parses out > to be a PPI::Structure::Block, it's mistakenly flagging the hashref as > violating this policy. > > I've actually worked up a patch that I think fixes this, but I wanted > to open a ticket for it first so I could reference it in my patch to > the ProhibitCommaSeparatedStatements.run file.
I'm not so sure about taking a Perl::Critic patch for this. The issue is what happens when PPI changes its parsing behavior. I would prefer a PPI fix for this situation. Show quoted text
> func( { %hash, bar => 2 } );
This isn't a general solution, but, as workaround, if it is safe to reverse the hash constructor arguments as in func( { bar => 2, %hash } ); this problem will go away.
Subject: Re: [rt.cpan.org #48033] False positive for ValuesAndExpressions::ProhibitCommaSeparatedStatements
Date: Mon, 20 Jul 2009 18:15:01 -0400
To: bug-Perl-Critic [...] rt.cpan.org
From: Packy Anderson <packyanderson [...] gmail.com>
On Mon, Jul 20, 2009 at 6:00 PM, Elliot Shank via RT<bug-Perl-Critic@rt.cpan.org> wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=48033 > > > Packy Anderson via RT wrote:
>> Because the direct parent of the code containing the comma parses out >> to be a PPI::Structure::Block, it's mistakenly flagging the hashref as >> violating this policy. >> >> I've actually worked up a patch that I think fixes this, but I wanted >> to open a ticket for it first so I could reference it in my patch to >> the ProhibitCommaSeparatedStatements.run file.
> > I'm not so sure about taking a Perl::Critic patch for this.  The issue is what happens when PPI changes its parsing behavior.  I would prefer a PPI fix for this situation. >
>> func( { %hash, bar => 2 } );
> > This isn't a general solution, but, as workaround, if it is safe to reverse the hash constructor arguments as in > >    func( { bar => 2, %hash } ); > > this problem will go away.
Hmm. Well, take a look at what I did, anyway. It might be worthwhile. -packy -- Packy Anderson Email: PackyAnderson@gmail.com GVoice: (646) 833-8832

Message body is not shown because sender requested not to inline it.