Subject: | Build fails due to Perl::Critic violations |
Hi there-
I was installing Module-CPANTS-Analyse, (by way of the cpan shell) and
the 99_critic.t script emitted several failures due to violation of
various Perl::Critic policies.
I'm sure it passes the 99_critic.t tests on your machine because you
have customized your .perlcriticrc file to fit your personal coding
standards. But your .perlcriticrc file is not the same as mine.
In general, I think CPAN distributions should not be shipped with a
Test::Perl::Critic script, or else it should be disabled by default.
For example, the Perl-Critic distro contains a criticize.t script, but
it skips all the tests unless the AUTHOR_TEST environment variable is
set to a true value. (See http://search.cpan.org/src/THALJEF/Perl-
Critic-0.21/t/40_criticize.t)
In addition, you can ship your distribution with a copy of your custom
perlcriticrc file, and then point Test::Perl::Critic at it:
use File::Spec;
eval { require Test::Perl::Critic };
plan skip_all => 'Test::Perl::Critic needed to critique' if $@;
my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
Test::Perl::Critic->import( -profile => $rcfile );
all_critic_ok();
That way, the distro is critiqued using the settings that you
intended. However, this still might cause unexpected failures because
the end-user may have additional Perl::Critic policies installed on
their local machine. So again, it is best to have the
Test::Perl::Critic test disabled by default.
I apologize for not making this a little clearer in the
Test::Perl::Critic documentation. I'll try and improve it in the next
release.
-Jeff