my @site_policies = Perl::Critic::PolicyFactory->site_policy_names();
my @matching_policies = grep { $_ =~ m/$pattern/ixms } @site_policies;
- # "-T" means don't send to pager
+ # "-T" means don't send to pager
my @perldoc_output = map {`perldoc -T $_`} @matching_policies; ## no critic (ProhibitBacktick)
out @perldoc_output;
my ( $self, $eval_error ) = @_;
return if not $eval_error;
- confess $eval_error if not ref $eval_error; ## no critic (RequireUseOfExceptions)
+ confess $eval_error if not ref $eval_error;
if ( $eval_error->isa('Perl::Critic::Exception::Configuration') ) {
$self->add_exception($eval_error);
$self->add_exceptions_from($eval_error);
}
else {
- die $eval_error; ## no critic (RequireUseOfExceptions, RequireCarping)
+ die $eval_error; ## no critic (RequireCarping)
}
return;
my $prev = $token->sprevious_sibling;
return if $prev;
my $parent = $token->statement->parent;
- for (my $node = $parent; $node; $node = $node->parent) { ##no critic 'CStyleForLoop'
+ for (my $node = $parent; $node; $node = $node->parent) { ## no critic (CStyleForLoop)
next if $node->isa('PPI::Structure::List');
return 1 if $node->isa('PPI::Structure::Condition');
}
#-----------------------------------------------------------------------------
-Readonly::Scalar my $DESC => q{Forbid $b before $a in sort blocks}; ## no critic (Interpolation)
+Readonly::Scalar my $DESC => q{Forbid $b before $a in sort blocks}; ## no critic (InterpolationOfMetachars)
Readonly::Scalar my $EXPL => [ 152 ];
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
Readonly::Scalar my $DESC => q{UNIVERSAL::can should not be used as a function};
-Readonly::Scalar my $EXPL => q{Use eval{$obj->can($pkg)} instead}; ##no critic 'RequireInterp';
+Readonly::Scalar my $EXPL => q{Use eval{$obj->can($pkg)} instead}; ## no critic (RequireInterp);
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
Readonly::Scalar my $DESC => q{UNIVERSAL::isa should not be used as a function};
-Readonly::Scalar my $EXPL => q{Use eval{$obj->isa($pkg)} instead}; ##no critic 'RequireInterp';
+Readonly::Scalar my $EXPL => q{Use eval{$obj->isa($pkg)} instead}; ## no critic (RequireInterp);
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
-Readonly::Scalar my $DESC => q{Use "local $/ = undef" or File::Slurp instead of joined readline}; ##no critic qw(Interpolation)
+Readonly::Scalar my $DESC => q{Use "local $/ = undef" or File::Slurp instead of joined readline}; ## no critic qw(InterpolationOfMetachars)
Readonly::Scalar my $EXPL => [213];
#-----------------------------------------------------------------------------
Readonly::Scalar my $DESC => q<Close filehandles as soon as possible after opening them>;
Readonly::Scalar my $EXPL => [209];
-Readonly::Scalar my $SCALAR_SIGIL => q<$>; ## no critic (InterpolationOfLiterals)
+Readonly::Scalar my $SCALAR_SIGIL => q<$>;
Readonly::Scalar my $GLOB_SIGIL => q<*>;
#-----------------------------------------------------------------------------
# Set configuration, if defined.
my @keywords = keys %{ $self->{_keywords} };
if ( @keywords ) {
- ## no critic ProhibitEmptyQuotes
$self->{_keyword_sets} = [ [ @keywords ] ];
}
# These are module name patterns (e.g. /Acme/)
my $actual_regex;
- eval { $actual_regex = qr/$regex_string/; 1 } ## no critic (RegularExpressions)
+ eval { $actual_regex = qr/$regex_string/; 1 } ## no critic (ExtendedFormatting, LineBoundaryMatching, DotMatchAnything)
or throw_policy_value
policy => $self->get_short_name(),
option_name => 'modules',
Readonly::Scalar my $EXPL => [248];
Readonly::Array my @PATTERNS => ( # order matters: most to least specific
- [q{ },'\\t','\\r','\\n'] => ['\\s', '\\S'], ##no critic (Interpolation)
+ [q{ },'\\t','\\r','\\n'] => ['\\s', '\\S'], ## no critic (InterpolationOfMetachars)
['A-Z','a-z','_'] => ['\\w', '\\W'],
['A-Z','a-z'] => ['[[:alpha:]]','[[:^alpha:]]'],
['A-Z'] => ['[[:upper:]]','[[:^upper:]]'],
for my $element ($anyof->children) {
if ($element->isa('Perl::Critic::PPIRegexp::exact')) {
my @tokens = split m/(\\.[^\\]*)/xms, $element->content;
- for my $token (map { split m/\A (\\[nrf])/xms, _fixup($_); } @tokens) { ##no critic(Comma) ## TODO: FALSE POSITIVE
+ for my $token (map { split m/\A (\\[nrf])/xms, _fixup($_); } @tokens) {
$elements{$token} = 1;
}
} elsif ($element->isa('Perl::Critic::PPIRegexp::anyof_char') ||
}
Readonly::Hash my %HEX => ( # Note: this is ASCII specific!
- '0a' => '\\n', ##no critic (Interpolation)
- '0c' => '\\f', ##no critic (Interpolation)
- '0d' => '\\r', ##no critic (Interpolation)
+ '0a' => '\\n', ## no critic (InterpolationOfMetachars)
+ '0c' => '\\f', ## no critic (InterpolationOfMetachars)
+ '0d' => '\\r', ## no critic (InterpolationOfMetachars)
'20' => q{ },
);
sub _fixup {
Readonly::Scalar my $DESC => q{Use character classes for literal metachars instead of escapes};
Readonly::Scalar my $EXPL => [247];
-Readonly::Hash my %REGEXP_METACHARS =>
- hashify split m/ /xms, '{ } ( ) . * + ? |'; ##no critic(Interpolation)
+Readonly::Hash my %REGEXP_METACHARS => hashify(split / /xms, '{ } ( ) . * + ? |');
#-----------------------------------------------------------------------------
return $self->violation( $DESC, $EXPL, $elem );
}
-sub _enough_assignments { ##no critic(ExcessComplexity) # TODO
+sub _enough_assignments {
my ($elem, $captures) = @_;
# look backward for the assignment operator
#-----------------------------------------------------------------------------
-Readonly::Scalar my $AT => q{@}; ##no critic(Interpolation)
-Readonly::Scalar my $AT_ARG => q{@_}; ##no critic(Interpolation)
+Readonly::Scalar my $AT => q{@};
+Readonly::Scalar my $AT_ARG => q{@_}; ## no critic (InterpolationOfMetachars)
Readonly::Scalar my $DESC => q{Too many arguments};
Readonly::Scalar my $EXPL => [182];
#-----------------------------------------------------------------------------
-Readonly::Scalar my $AT => q{@}; ##no critic(Interpolation)
-Readonly::Scalar my $AT_ARG => q{@_}; ##no critic(Interpolation)
+Readonly::Scalar my $AT => q{@};
+Readonly::Scalar my $AT_ARG => q{@_}; ## no critic (InterpolationOfMetachars)
Readonly::Scalar my $DESC => qq{Always unpack $AT_ARG first};
Readonly::Scalar my $EXPL => [178];
for my $variable_name ( $elem->variables() ) {
next if $variable_name =~ $PACKAGE_RX;
# special exception for Test::More
- next if $variable_name eq '$TODO'; ##no critic(Interpolat)
+ next if $variable_name eq '$TODO'; ## no critic (InterpolationOfMetachars)
return if ! is_perl_global( $variable_name );
}
return 1;
while ( <$fh> ) {
++$lineno;
chomp;
- my $inheader = /^## name/ .. /^## cut/; ## no critic(RegularExpression)
+ my $inheader = /^## name/ .. /^## cut/; ## no critic (ExtendedFormatting LineBoundaryMatching DotMatchAnything)
my $line = $_;
if (defined $subtest->{error}) {
if ( $subtest->{error} =~ m{ \A / (.*) / \z }xms) {
- $subtest->{error} = eval {qr/$1/}; ##no critic (RegularExpressions::)
+ $subtest->{error} = eval {qr/$1/}; ## no critic (ExtendedFormatting LineBoundaryMatching DotMatchAnything)
if ($EVAL_ERROR) {
throw_internal
"$subtest->{name} 'error' has a malformed regular expression";
my $src_isa_name = $src_class . '::ISA';
my $dest_isa_name = $dest_class . '::ISA';
my @isa;
- for my $isa (eval "\@$src_isa_name") { ##no critic(Eval)
+ for my $isa (eval "\@$src_isa_name") { ## no critic (StringyEval)
my $dest_isa = _get_ppi_package($isa, $re_node);
push @isa, $dest_isa;
}
- eval "\@$dest_isa_name = qw(@isa)"; ##no critic(Eval)
+ eval "\@$dest_isa_name = qw(@isa)"; ## no critic (Eval)
croak $EVAL_ERROR if $EVAL_ERROR;
}
return $dest_class;
ref $_[0] || shift; #Can call as object or class method
return scalar @_ if ! wantarray; #In case we are called in scalar context
- ## no critic qw(RequireSimpleSort);
## TODO: What if $a and $b are not Violation objects?
return
map {$_->[0]}
ref $_[0] || shift; #Can call as object or class method
return scalar @_ if ! wantarray; #In case we are called in scalar context
- ## no critic qw(RequireSimpleSort);
## TODO: What if $a and $b are not Violation objects?
return
map {$_->[0]}