Perl-Critic-TooMuchCode
view release on metacpan or search on metacpan
0.19
- Released at 2023-05-05T21:24:23+0900
- ProhibitDuplicateLiteral: Improve description by including the literal and excluding line and column numbers.
- ProhibitDuplicateSub: Allow multiple BEGIN, UNITCHECK, CHECK, INIT and END code blocks
- Some improvements of documentation.
0.18
- Released at 2021-09-29T08:43:04+0900
- ProhibitDuplicateLiteral: the parameter "whitelist" is renamed to "allowlist"
- ProhibitDuplicateLiteral: the parameter "whitelist_number" is removed
- ProhibitUnusedImport: Deal with the special form of assigning to @EXPORT and @EXPORT_OK. Github PR #29, issue #18
0.17
- Released at 2021-09-20T20:44:45+0900
lib/Perl/Critic/Policy/TooMuchCode/ProhibitDuplicateSub.pm view on Meta::CPAN
use parent 'Perl::Critic::Policy';
sub default_themes { return qw( bugs maintenance ) }
sub applies_to { return 'PPI::Document' }
sub initialize_if_enabled {
my ($self, $config) = @_;
$self->{_allow_duplicates_for} = {
BEGIN => 1,
UNITCHECK => 1,
CHECK => 1,
INIT => 1,
END => 1,
};
return $TRUE;
}
sub violates {
my ($self, undef, $doc) = @_;
t/TooMuchCode/ProhibitDuplicateSub.run view on Meta::CPAN
package Here {
sub inc { $_[0] + 1 }
sub dec { $_[0] - 1 }
sub inc { 1 + $_[0] }
};
package There {
sub inc { 1 + $_[0] }
};
## name Multiple BEGIN, UNITCHECK, CHECK, INIT or END blocks
## failures 0
## cut
BEGIN {}
BEGIN {}
UNITCHECK {}
UNITCHECK {}
CHECK {}
CHECK {}
INIT {}
INIT {}
END {}
END {}
( run in 1.224 second using v1.01-cache-2.11-cpan-748bfb374f4 )