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

People
Owner: Nobody in particular
Requestors: xanni [...] glasswings.com.au
Cc:
AdminCc:

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



Subject: False positive in TestingAndDebugging::ProhibitNoWarnings (bad parsing)
Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings incorrectly flags the following statement even when "allow_with_category_restriction" is set: no warnings 'qw'; This is because the code to parse the "no warnings" statement explicitly ignores the word "qw", intending to exclude the 'qw' at the beginning of a quoted word list of warnings to disable, but also ignoring the warning whose name is 'qw'. Moral: Parsing quoting is hard.
Thank you for your report. I confess to not being conscious there _was_ a 'qw' warnings category, though come to think of it I have gotten them. Patch committed as SVN revision 4115. As you pointed out, the original code pulled the statement apart with regexes, and discarded 'no', 'warnings', and 'qw' wherever found. The patch makes use of the PPI parse. It recurses into the statement being analyzed, looking at all words, the contents of quoted strings, and the contents of qw{} strings. Everything thus found is looked at, except for the first two found, which are, of course, 'no' and 'warnings'.
Fixed and released in Perl-Critic-1.118 -- Jeffrey Thalhammer Imaginative Software Systems www.imaginative-software.com