TooMuchCode::ProhibitDuplicateLiteral - Don't repeat yourself with identical literals
This policy checks if there are string/number literals with identical value in the same piece of perl code. Usually that's a small signal of repeating and perhaps a small chance of refactoring.
Some strings/numbers may be allowed to have duplicates by listing them in the allowlist parameter in the configs:
allowlist
[TooMuchCode::ProhibitDuplicateLiteral] allowlist = 'present' "forty two" 42
The values is a space-separated list of numbers or quoted string.
The default values in the allowlist are: 0 1. These two numbers are always part of allowlist and cannot be removed.
0 1
Please be aware that, a string literal and its numerical literal counterpart (1 vs "1") are considered to be the same. Adding "42" to the allowlist is the same as adding 42.
1
"1"
"42"
42
To install Perl::Critic::TooMuchCode, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::Critic::TooMuchCode
CPAN shell
perl -MCPAN -e shell install Perl::Critic::TooMuchCode
For more information on module installation, please visit the detailed CPAN module installation guide.