Subject: | Suggested policy: if string constant exists, check it is used consistently |
Often you abstract out a commonly-occuring string into a constant. For
example
my $maintainer = 'support@foo.com';
...
die "unexpected error - please contact $maintainer";
But you may forget about that constant and use the string directly in
some cases:
my $maintainer = 'support@foo.com';
...
die "unexpected error - please contact $maintainer";
...
warn 'strange condition - report to support@foo.com';
It would be useful to have a policy which, on seeing a string variable
defined in the code with a compile-time string, warns about occurrences
of that string later on in the code, in places where the variable is in
scope.