Perl::Critic::Policy::BadStrings - Search for bad strings in source files
This policy will search for "bad words" in a file. It does this by looking at the raw Perl file, so the "bad words" can include different types of elements.
The obvious use for this module would be to search for obscene words, but it can also be used to look for obsolete product names, former company names, and, useful for the author, previous author names.
Another possible use is to search for strings such as "TODO:".
The search is performed without regard for the case of the match (if you search for "FOO!" and the string "foo!" appears in the file, it will match).
This policy is a policy (the only one!) in the Perl::Critic::Policy::BadStrings distribution. The policy is also themed: badstring.
This policy allows you to configure the "words" that it will alert upon.
words = poo || Acme Industries
By default, no words are searched (so you must configure this policy for it to be useful). However, with the above example, files are examined for the presence of either of the string "poo" or the string "Acme Industries".
severity = 4
By default, the severity used by this module is 3, or "medium". This can be configured in the standard way used by other Critic modules.
This policy only reports the first "bad word" found in the file, even if there are many matches of many different words. It also does not properly report the line/location of the problem, but instead says that the problem is always in line 1, column 1. Patches are welcome!
Joelle Maslak <email@example.com>
This software is copyright (c) 2017 by Joelle Maslak.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Perl::Critic::Policy::BadStrings, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.