Subject: | Ignored regions are too aggressive (##no critic on conditionals) |
If you add a "## no critic" comment to a control structure, everything inside of that structure is ignored. This is because the directive deletes the tree node that represents the conditional and all of its children. Instead, perhaps the code should try to flag the node.
For example:
package Foo;
use strict;
use warnings;
our $VERSION=0;
unless ($foo) ## no critic
{
eval "bar" unless ($@);
}
1;
generates no criticisms. Without the "## no critic", this causes the following under v0.12_01:
'unless' block used at line 5, column 4. See page 97 of PBP.
Expression form of 'eval' at line 7, column 7. See page 161 of PBP.
Useless interpolation of literal string at line 7, column 12. See page 51 of PBP.
Postfix control 'unless' used at line 7, column 18. See pages 96,97 of PBP.
Magic punctuation variable used at line 7, column 26. See page 79 of PBP.