Monks,
I would like Perl::Critic to behave differently depending on file type (i.e. file extension).
I use emacs' cperl-mode with perlcritic-mode on test files (.t) as well as on perl modules (.pm) and perl scripts (.pl).
For example I don't want to require my test files to be contained in a package, as dictated by Perl::Critic::Policy::Modules::RequireExplicitPackage. This policy allows exceptions for perl scripts as defined by sub is_script in Perl::Critic::Utils, but there is no equivalent for test files.
I can, of course, add #! to the beginning of all test files, but I would rather solve the problem than go around it. I am thinking about a patch that adds sub is_test_script to Perl::Critic::Utils[1] and adds a parameter exempt_test_scripts to the policy.
Any guidance on the narrow path to enlightenment is appreciated.
[1] Yes, even though the source says This module is way too large.
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.