Login
Woops, I left a naked subroutine out there.
authorJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Sun, 26 Oct 2008 07:01:26 +0000 (07:01 +0000)
committerJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Sun, 26 Oct 2008 07:01:26 +0000 (07:01 +0000)
Also re-arranged some code slightly.  I do like to take advantage of
the postfix-if-with-flow-control-statements rule.

lib/Perl/Critic.pm
lib/Perl/Critic/Policy/Miscellanea/ProhibitUnrestrictedNoCritic.pm

index 0406ad2..36e9daf 100644 (file)
@@ -192,14 +192,11 @@ sub _critique {
     return if not $policy->prepare_to_scan_document($doc);
 
     my $maximum_violations = $policy->get_maximum_violations_per_document();
-    my %policies_that_cannot_be_disabled = hashify(_policies_that_cannot_be_disabled());
-
-    if (defined $maximum_violations && $maximum_violations == 0) {
-        return;
-    }
+    return if defined $maximum_violations && $maximum_violations == 0;
 
     my @violations = ();
     my $policy_name = $policy->get_long_name();
+    my %policies_that_cannot_be_disabled = hashify(_policies_that_cannot_be_disabled());
 
   TYPE:
     for my $type ( $policy->applies_to() ) {
index 0e4dd84..6df5787 100644 (file)
@@ -28,9 +28,9 @@ sub supported_parameters { return ()                         }
 sub default_severity     { return $SEVERITY_MEDIUM           }
 sub default_themes       { return qw( core maintenance )     }
 sub applies_to           { return 'PPI::Token::Comment'      }
-sub can_be_disabled      { return $FALSE                     }
 
 #-----------------------------------------------------------------------------
+# TODO: Consolidate these regexen with those used in Critic.pm
 
 sub violates {
     my ( $self, $elem, undef ) = @_;