NAME

Perl::Critic::Policy::BadStrings - Search for bad strings in source files

VERSION

version 1.000

DESCRIPTION

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).

AFFILIATION

This policy is a policy (the only one!) in the Perl::Critic::Policy::BadStrings distribution. The policy is also themed: badstring.

CONFIGURATION AND ENVIRONMENT

This policy allows you to configure the "words" that it will alert upon.

words

[BadStrings]
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

[BadStrings]
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.

BUGS AND TODO

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!

AUTHOR

Joelle Maslak <jmaslak@antelope.net>

COPYRIGHT AND LICENSE

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.