1Test2::Tools::PerlCritiUcs(e3r)Contributed Perl DocumentTaetsito2n::Tools::PerlCritic(3)
2
3
4

NAME

6       Test2::Tools::PerlCritic - Testing tools to enforce Perl::Critic
7       policies
8

VERSION

10       version 0.03
11

SYNOPSIS

13        use Test2::V0;
14        use Test2::Tools::PerlCritic;
15
16        perl_critic_ok 'lib', 'test library files';
17        perl_critic_ok 't',   'test test files';
18
19        done_testing;
20

DESCRIPTION

22       Test for Perl::Critic violations using Test2.  Although this testing
23       tool uses the Test2 API instead of the older Test::Builder API, the
24       primary motivation is to provide output in a more useful form.  That is
25       policy violations are grouped by policy class, and the policy class
26       name is clearly displayed as a diagnostic.  The author finds the former
27       more useful because he tends to address one type of violation at a
28       time.  The author finds the latter more useful because he tends to want
29       to lookup or adjust the configuration of the policy as he is addressing
30       violations.
31

FUNCTIONS

33   perl_critic_ok
34        perl_critic_ok $file_or_directory, \@options, $test_name;
35        perl_critic_ok $file_or_directory, \%options, $test_name;
36        perl_critic_ok $file_or_directory, $critic, $test_name;
37        perl_critic_ok $file_or_directory, $test_name;
38        perl_critic_ok $file_or_directory;
39
40       Run Perl::Critic on the given file or directory.  If "\@options" or
41       "\%options" are provided, then they will be passed into the
42       Perl::Critic constructor.  If $critic (an instance of Perl::Critic) is
43       provided, then that Perl::Critic instance will be used instead of
44       creating one internally.  Finally the $test_name may be provided if you
45       do not like the default test name.
46
47       Only a single test is run regardless of how many files are processed.
48       this is so that the policy violations can be grouped by policy class
49       across multiple files.
50
51       As a convenience, if the test passes then a true value is returned.
52       Otherwise a false will be returned.
53
54       "done_testing" or the equivalent is NOT called by this function.  You
55       are responsible for calling that yourself.
56

CAVEATS

58       Test::Perl::Critic has been around longer, and probably does at least
59       some things smarter.  The fact that this module groups policy
60       violations for all files by class means that it has to store more
61       diagnostics in memory before sending them out en masse, where as
62       Test::Perl::Critic sends violations for each file as it processes them.
63       Test::Perl::Critic also comes with some code to optionally do
64       processing in parallel.  Some of these issues may or may not be
65       addressed in future versions of this module.
66
67       Since this module formats it's output the "-verbose" option is ignored
68       at the "set_format" value is ignored.
69

SEE ALSO

71       Test::Perl::Critic
72       Perl::Critic
73

AUTHOR

75       Graham Ollis <plicease@cpan.org>
76
78       This software is copyright (c) 2019 by Graham Ollis.
79
80       This is free software; you can redistribute it and/or modify it under
81       the same terms as the Perl 5 programming language system itself.
82
83
84
85perl v5.32.1                      2021-01-27       Test2::Tools::PerlCritic(3)
Impressum