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.04
11

SYNOPSIS

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

DESCRIPTION

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

FUNCTIONS

32   perl_critic_ok
33        perl_critic_ok $path, \@options, $test_name;
34        perl_critic_ok \@path, \@options, $test_name;
35        perl_critic_ok $path, \%options, $test_name;
36        perl_critic_ok \@path, \%options, $test_name;
37        perl_critic_ok $path, $critic, $test_name;
38        perl_critic_ok \@path, $critic, $test_name;
39        perl_critic_ok $path, $test_name;
40        perl_critic_ok \@path, $test_name;
41        perl_critic_ok $path;
42        perl_critic_ok \@path;
43
44       Run Perl::Critic on the given files or directories.  The first argument
45       ($path or "\@path") can be either the path to a file or directory, or a
46       array reference to a list of paths to files and directories.  If
47       "\@options" or "\%options" are provided, then they will be passed into
48       the Perl::Critic constructor.  If $critic (an instance of Perl::Critic)
49       is provided, then that Perl::Critic instance will be used instead of
50       creating one internally.  Finally the $test_name may be provided if you
51       do not like the default test name.
52
53       Only a single test is run regardless of how many files are processed.
54       this is so that the policy violations can be grouped by policy class
55       across multiple files.
56
57       As a convenience, if the test passes then a true value is returned.
58       Otherwise a false will be returned.
59
60       "done_testing" or the equivalent is NOT called by this function.  You
61       are responsible for calling that yourself.
62
63       Since we do not automatically call "done_testing", you can call
64       "perl_critic_ok" multiple times, but keep in mind that the policy
65       violations will only be grouped in each individual call, so it is
66       probably better to provide a list of paths, rather than make multiple
67       calls.
68

CAVEATS

70       Test::Perl::Critic has been around longer, and probably does at least
71       some things smarter.  The fact that this module groups policy
72       violations for all files by class means that it has to store more
73       diagnostics in memory before sending them out en masse, where as
74       Test::Perl::Critic sends violations for each file as it processes them.
75       Test::Perl::Critic also comes with some code to optionally do
76       processing in parallel.  Some of these issues may or may not be
77       addressed in future versions of this module.
78
79       Since this module formats it's output the "-verbose" option is ignored
80       at the "set_format" value is ignored.
81

SEE ALSO

83       Test::Perl::Critic
84       Perl::Critic
85

AUTHOR

87       Graham Ollis <plicease@cpan.org>
88
90       This software is copyright (c) 2019-2021 by Graham Ollis.
91
92       This is free software; you can redistribute it and/or modify it under
93       the same terms as the Perl 5 programming language system itself.
94
95
96
97perl v5.36.0                      2023-01-20       Test2::Tools::PerlCritic(3)
Impressum