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

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

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Is "no strict" really of the highest severity?
I ran perlcritic over MakeMaker and one of the things I noticed is this: Stricture disabled at line 797, column 5. See page 429 of PBP. (Severity: 5) Now I enjoy strict as much as the next guy, but turning it off in select cases is not bad practice, it's just expert practice. Perhaps the severity of this critique should be lowered? It's certainly not of the same level as "Loop iterator is not lexical". What should be severity 5 is "no strict" at the file scope.
From: mschwern [...] cpan.org
Thinking more on this, here's what should be critic'd. * Lacking a "use strict" at the file scope. * Any use of "no strict" at the file scope. * Using "no strict;" without modifiers. The following is bad. You're turning off too much. use strict; { no strict; ... } But this is ok. You're turning off just what you need. use strict; { no strict 'refs'; ... }
On Sat Dec 29 13:45:41 2007, MSCHWERN wrote: Show quoted text
> Thinking more on this, here's what should be critic'd. > > * Lacking a "use strict" at the file scope. > * Any use of "no strict" at the file scope. > * Using "no strict;" without modifiers.
I'd go even further to say that while turning off strict refernces has it's use (aliasing) there's little good use for turning off strict subs or vars. So I'd reduce the rules to... * Lacking a "use strict" at the file scope. * Any use of "no strict" at the file scope. * Turning off anything but strict refs. You might even want to leave in a critic of "no strict 'refs'" at a lower severity.
I admit that this Policy wasn't directly inspired by PBP. I work in an shop where there is a lot of non-strict code that might get copy-and-pasted, and where perl-newbies might run afoul of the "ref" stricture and then blindy disable strictures altogether. So I wanted to make it very hard for people to disable strictures. If you think that "no strict 'refs'" is generally acceptable, then you can configure that in your perlcriticrc file like this: [TestingAndDebugging::ProhibitNoStrict] allow = refs I can certainly see how experienced developers (like yourself) would want to ease restrictions on a tightly scoped "no strict ...". You could probably convince Ricardo Signes to add a variation of this Policy to his Perl-Critic-Lax distro. Happy new year! -Jeff