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

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

Bug Information
Severity: Normal
Broken in: 0.13
Fixed in: 0.13_01



Subject: False Positive: single arg select
The following code results in a Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect violation: sub select { # whatever... } While this may not be in line with Conway's other rules against homonymic sub names, it's definitely not a "one arg select" violation. I'd suggest the following pre-condition (or something like it) be added to the InputOutput::ProhibitOneArgSelect::violates method: return if $elem->sprevious_sibling eq 'sub'; Here's a failing test case to aid in implementing the fix: use Test::More tests => 1; use strict; use Perl::Critic; my $critic = Perl::Critic->new( -profile => 'NONE' ); $critic->add_policy(-policy=>'Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect' ); my @errors = $critic->critique( \'sub select { return "foo" }' ); is( scalar(@errors), 0, 'no errors' ) or diag @errors; Thanks for you great work on this set of modules. It's a great tool for increasing code quality! Brian