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

People
Owner: Nobody in particular
Requestors: sabol [...] alderaan.gsfc.nasa.gov
Cc:
AdminCc:

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



Subject: False positive in ErrorHandling::RequireCarping
The ErrorHandling::RequireCarping policy (with allow_messages_ending_with_newlines activated) complains about a terminal literal linefeed in a qq{} block. I believe this is a common and useful construct for programs giving usage information, for example, like so: die qq{A horrible death }; Here's a patch to the Perl::Critic 1.03 test suite which reveals the problem: --- t/ErrorHandling/RequireCarping.run~ 2007-02-13 14:32:46.000000000 -0500 +++ t/ErrorHandling/RequireCarping.run 2007-02-20 00:18:24.912784000 -0500 @@ -117,6 +117,8 @@ ## failures 0 ## cut +die qq{A horrible death +} ; die "A horrible death\n" ; die "A horrible death\n" # last statement doesn't need a terminator
From: THALJEF [...] cpan.org
Show quoted text
> die qq{A horrible death > };
That certainly is valid, but I would disagree that it is common or even desirable. On page 60 of PBP, Conway explictly advises against using implicit newlines embedded in strings. Better to use concatenation or a heredoc for multi-line strings. If we don't already have one, I will add a TODO item to create a policy that prohibits strings with implicit newlines. -Jeff
From: sabol [...] alderaan.gsfc.nasa.gov
On Tue Mar 06 14:41:52 2007, THALJEF wrote: Show quoted text
> > die qq{A horrible death > > };
> > That certainly is valid, but I would disagree that it is common or even > desirable. On page 60 of PBP, Conway explictly advises against using > implicit newlines embedded in strings. Better to use concatenation or > a heredoc for multi-line strings. If we don't already have one, I will > add a TODO item to create a policy that prohibits strings with implicit > newlines. > > -Jeff
Well, that's another policy then and some people (myself included) may disagree and disable such a policy. This policy is still giving false positives in the described scenario, and I think it should be fixed.
From: THALJEF [...] cpan.org
Show quoted text
> This policy is still giving false positives in the described > scenario, and I think it should be fixed.
Agreed. I'll see what I can do. Thanks. -Jeff