I try ## no critic (Modules::RequireExplicitPackage) at end of first line, but it don't help - error appear for next lineWhen I add ## no critic (Modules::RequireExplicitPackage) before the first line, the Code not contained in explicit package. Violates encapsulation message disappears for me:
## no critic (Modules::RequireExplicitPackage) use lib qw( lib ); use strict; use warnings; use Test::More tests => 1;
This was my original response...
According to the POD for Perl::Critic::Policy::Modules::RequireExplicitPackage, there are no hooks for disabling this check. However, it does say:
so this Policy doesn't apply to files that begin with a perl shebang.If you add a shebang line to your test file, the check is suppressed:
If you don't want to do that, then you could just post-process the output of perlcritic and filter out these messages.#!/usr/bin/env perl
You can also request that this feature be added to the module at https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic. Better yet, figure out how to modify the module yourself and submit a patch (that increases the chances of having the feature added).
In reply to Re: perlcritic & test files
by toolic
in thread perlcritic & test files
by Bor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |