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

People
Owner: Nobody in particular
Requestors: brianski [...] cpan.org
Cc:
AdminCc:

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



Subject: false positive for leading tabs
See the attached file. In short, perl critic interprets as a string what is in an extended regexp, causing it to complain about things like the attached, even if the hard tabs at the beginning of lines settings should permit it. ski@ganiodayo:~/tmp$ perl -e 'use Perl::Critic; my $critic = Perl::Critic->new(-severity => 3); my $str = join("", <>); print $critic->critique(\$str); ' <perl-critic-bug.pl Hard tabs used at line 7, column 7. See page 20 of PBP.
Subject: perl-critic-bug.pl
#!/usr/bin/perl -w use strict; use warnings; my $x = "foo"; $x =~ m/ some (really | long) pattern /mx;
Subject: Re: [rt.cpan.org #32440] false positive for leading tabs
Date: Sat, 19 Jan 2008 17:16:43 -0600
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <elliotjs [...] cpan.org>
Brian Szymanski via RT wrote: Show quoted text
> See the attached file. > > In short, perl critic interprets as a string what is in an extended > regexp, causing it to complain about things like the attached, even if > the hard tabs at the beginning of lines settings should permit it.
Oog. PPI hands us back the regex as a single entity. It's not like normal whitespace. There'll have to be a special case done to handle this. I'm trying to think if there's any other similar situation, but I can't think of one at the minute.
From: ski-cpan [...] allafrica.com
ELLIOTJS via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=32440 > > > Oog. PPI hands us back the regex as a single entity. It's > not like normal whitespace. >
Yeah, that's about what I figured re: PPI. Looks like you can get the same behavior with any other string, though: ski@ganiodayo:~/tmp$ perl -e 'use Perl::Critic; my $critic = Perl::Critic->new(-severity => 3); my $str = join("", <>); print $critic->critique(\$str); ' <perl-critic-bug2.pl Hard tabs used at line 6, column 9. See page 20 of PBP. Literal line breaks in a string at line 6, column 9. See pages 60,61 of PBP. ski@ganiodayo:~/tmp$ perl -e 'use Perl::Critic; my $critic = Perl::Critic->new(-severity => 3); my $str = join("", <>); print $critic->critique(\$str); ' <perl-critic-bug3.pl Hard tabs used at line 6, column 9. See page 20 of PBP. Literal line breaks in a string at line 6, column 9. See pages 60,61 of PBP. The Literal line breaks critique is legit, the hard tabs one is not. So I think any string or regexp should be special cased the same way for this.
#!/usr/bin/perl -w use strict; use warnings; my $x = " some (really | long) pattern ";
#!/usr/bin/perl -w use strict; use warnings; my $x = ' some (really | long) pattern ';
Or, to put my last statement another way - you don't lose anything by applying the same tab-after-newline principle to all strings, because those are already caught by Perl::Critic.
Subject: Re: [rt.cpan.org #32440] false positive for leading tabs
Date: Sun, 20 Jan 2008 18:58:36 -0600
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Brian Szymanski via RT wrote: Show quoted text
> Or, to put my last statement another way - you don't lose anything by > applying the same tab-after-newline principle to all strings, because > those are already caught by Perl::Critic.
I entirely disagree. Leading tabs within a string, heredoc, or regex that doesn't have the /x modifier are very different from leading tabs within a /x modified regex.
On Sun Jan 20 19:58:54 2008, clonezone wrote: Show quoted text
> I entirely disagree. Leading tabs within a string, heredoc, or regex > that doesn't have the /x modifier are very different from leading tabs > within a /x modified regex.
Fair enough - just my 2 cents. C,B
Fixed and released in version 1.092.