is in core.
There's still issues with Utils::PPIRegexp and
ProhibitParensWithBuiltins: I can't come up with descriptive
names for these things. Help!
# the driver what the parameter types are so that we can use execute()
# without calling bind_param() each time. See "Binding Values Without
# bind_param()" on pages 126-7 of "Programming the Perl DBI".
+
+ ## no critic (ProhibitMagicNumbers)
$insert_statement->bind_param( 1, 'x', SQL_VARCHAR);
$insert_statement->bind_param( 2, 1, SQL_INTEGER);
$insert_statement->bind_param( 3, 1, SQL_INTEGER);
$insert_statement->bind_param( 4, 1, SQL_INTEGER);
$insert_statement->bind_param( 5, 'x', SQL_VARCHAR);
$insert_statement->bind_param( 6, 'x', SQL_VARCHAR);
- $insert_statement->bind_param( 6, 'x', SQL_VARCHAR);
+ $insert_statement->bind_param( 7, 'x', SQL_VARCHAR);
+ ## use critic
return $insert_statement;
}
my $num_args;
if ($elem->prototype) {
# subtract two for the "()" on the prototype
- $num_args = -2 + length $elem->prototype;
+ $num_args = -2 + length $elem->prototype; ## no critic (ProhibitMagicNumbers)
} else {
$num_args = _count_args($elem->block->schildren);
}
") are not allowed.$USE_READONLY_OR_CONSTANT";
Readonly::Scalar my $UNSIGNED_NUMBER =>
- qr<
+ qr{
\d+ (?: [$PERIOD] \d+ )? # 1, 1.5, etc.
| [$PERIOD] \d+ # .3, .7, etc.
- >xms;
+ }xms;
Readonly::Scalar my $SIGNED_NUMBER => qr/ [-+]? $UNSIGNED_NUMBER /xms;
+
+# The regex is already simplified. There's just a lot of variable use.
+## no critic (ProhibitComplexRegexes)
Readonly::Scalar my $RANGE =>
- qr<
+ qr{
\A
($SIGNED_NUMBER)
[$PERIOD] [$PERIOD]
[$RIGHT_PAREN]
)?
\z
- >xms;
+ }xms;
+## use critic
Readonly::Scalar my $SPECIAL_ARRAY_SUBSCRIPT_EXEMPTION => -1;
use strict;
use warnings;
+
use English qw(-no_match_vars);
-use PPI::Node;
+use Readonly;
use Carp qw(croak);
+use PPI::Node;
+
use base 'Exporter';
our $VERSION = '1.082';
}
}
+Readonly::Scalar my $NO_DEPTH_USED => -1;
+
sub ppiify {
my ($re) = @_;
return if !$re;
my $ppire = PPI::Node->new;
my @stack = ($ppire);
my $iter = $re->walker;
- my $last_depth = -1;
+ my $last_depth = $NO_DEPTH_USED;
while (my ($node, $depth) = $iter->()) {
if ($last_depth > $depth) { # -> parent
# walker() creates pseudo-closing nodes for reasons I don't understand
[InputOutput::RequireCheckedSyscalls]
functions = open close
-
-[ValuesAndExpressions::ProhibitMagicNumbers]
-allowed_values = -1 0 1 2