[BORISZ - Sat Sep 24 10:32:57 2005]:
Show quoted text> Hi,
> I noticed that the 'Long number' limit is far to low. ie:
>
> return sprintf( '%02d.%02d.%04d %02d:%02d:%02d',
> $d, $m + 1, $y + 1900, $h, $mm, $s );
>
> gives:
> Long number not separated with underscores a ...
>
> I never write 1_900 for that. I suggest a configure option for the
> limit.
>
This patch ups the number length to 7 (e.g., 1_000_000), which seems
reasonable:
$ diff -c RequireNumberSeparators.pm.orig RequireNumberSeparators.pm
*** RequireNumberSeparators.pm.orig 2005-09-30 17:53:24.000000000 -0400
--- RequireNumberSeparators.pm 2005-09-30 17:53:34.000000000 -0400
***************
*** 13,19 ****
my $expl = [55];
my $desc = q{Long number not separated with underscores};
my $nodes_ref = $doc->find('PPI::Token::Number') || return;
! my @matches = grep { $_ =~ m{ \d{4,} }x } @{$nodes_ref};
return map { Perl::Critic::Violation->new( $desc, $expl,
$_->location() ) }
@matches;
}
--- 13,19 ----
my $expl = [55];
my $desc = q{Long number not separated with underscores};
my $nodes_ref = $doc->find('PPI::Token::Number') || return;
! my @matches = grep { $_ =~ m{ \d{7,} }x } @{$nodes_ref};
return map { Perl::Critic::Violation->new( $desc, $expl,
$_->location() ) }
@matches;
}
ky