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

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

Bug Information
Severity: Normal
Broken in: 0.2
Fixed in: 0.22



Subject: use strict and use warnings *too* verbose.
The purpose of the use strict and use warnings tests are, I think, to note the fact that you haven't got them in your code, not actually note every line of code in the source that fails to be preceded by the pragma usage. Having the violations be reported multiple times per file drowns out any other reports. Given this code: print 'hi '; print 'world'; perlcritic (when testing only for TestingAndDebugging::RequireUseStrict), currently outputs: Code before strictures are enabled at line 1, column 1. Code before strictures are enabled at line 2, column 1. Desired output is just the first line: that's sufficient. Same for RequireUseWarnings. Apologies if this should be reported against the Policies themselves.
From: COKE [...] cpan.org
Having (belatedly, apologies) read the documentation for this policy, I see this is currently behaving as intended - I think there are still going to be a lot of users of this module are going to want just the sense described above "oh, there's no use strict in the file!". We can leave the current behavior the default, and give an option to just report the first line. I'd be happy to provide a patch if that would help. Regards.
From: jlv
I disabled the extra warnings, unless told otherwise: --- RequireUseStrict.pm.orig 2006-11-05 21:07:52.000000000 -0500 +++ RequireUseStrict.pm 2006-11-14 08:36:43.098198000 -0500 @@ -51,2 +51,4 @@ push @viols, $self->violation( $desc, $expl, $stmnt ); + last + unless exists $ENV{'USELESS_WARNINGS'}; } --- RequireUseWarnings.pm.orig 2006-11-05 21:07:52.000000000 -0500 +++ RequireUseWarnings.pm 2006-11-14 08:36:48.099963000 -0500 @@ -52,2 +52,4 @@ push @viols, $self->violation( $desc, $expl, $stmnt ); + last + unless exists $ENV{'USELESS_WARNINGS'}; }
Subject: Re: [rt.cpan.org #21795] use strict and use warnings *too* verbose.
Date: Tue, 14 Nov 2006 20:23:58 -0800 (PST)
To: bug-Perl-Critic [...] rt.cpan.org
From: Jeffrey Thalhammer <jeffrey_thalhammer [...] yahoo.com>
I agree that these two Policies are excessively noisy. This behavior arose because it was possible to put "##no critic" on the first offending statement, which would hide violations on that line and all the subsequent lines. We want to emphasize the strictures and warnings should be enabled _before_ almost any other code. So it's not enough to simply require that "use strict;" appears somewhere in the file. Part of me feels that strictures and warnings are so important that it warrants such a noisy Policy. But you're patch has given me some ideas. I think we can make some improvements. I'll keep you posted. -Jeff Show quoted text
____________________________________________________________________________________ Sponsored Link Mortgage rates near 39yr lows. $510k for $1,698/mo. Calculate new payment! www.LowerMyBills.com/lre
This has been fixed in Perl-Critic-0.22. Sorry I forgot to mention it in the Change log. -Jeff