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

People
Owner: thaljef [...] cpan.org
Requestors: cpan [...] clotho.com
Cc:
AdminCc:

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



Subject: False positive in CodeLayout::RequireTrailingCommas
I'm not sure yet if this is a P::C bug or a PPI bug... The following code fragment: my $var = ( 1 > 2 ? 0 : 1); triggers the following false warning: List declaration without trailing comma at line 2, column 18. See page 17 of PBP. (Severity: 1) Something appears to be wrong with $expr->schildren() or our use of it, because it is returning 7 instead of 1. -- Chris
Update: the problem is definitely P::C, not PPI. P::C takes an over-simplistic view of list children. It needs to count comma operators instead of child nodes. I propose that instead of checking if "@childnodes <= 1" it should check if "0 < grep {$_->isa('PPI::Token::Operator') && $_ eq ','} @children"