File Coverage

blib/lib/Code/TidyAll/Plugin/PerlCritic.pm
Criterion Covered Total %
statement 10 14 71.4
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 15 22 68.1


line stmt bran cond sub pod time code
1              
2             use strict;
3 2     2   16116 use warnings;
  2         5  
  2         60  
4 2     2   11  
  2         5  
  2         58  
5             use Moo;
6 2     2   9  
  2         5  
  2         18  
7             extends 'Code::TidyAll::Plugin';
8              
9             with 'Code::TidyAll::Role::RunsCommand';
10              
11             our $VERSION = '0.81';
12              
13             # On Windows only the batch file is actually executable.
14             my $cmd = $^O eq 'MSWin32' ? 'perlcritic.bat' : 'perlcritic';
15              
16 1     1   2222 my ( $self, $file ) = @_;
17              
18             my $output = $self->_run_or_die($file);
19 0     0 1   die "$output\n" unless $output =~ /^.* source OK\n/s;
20              
21 0           return;
22 0 0         }
23              
24 0           1;
25              
26             # ABSTRACT: Use perlcritic with tidyall
27              
28              
29             =pod
30              
31             =encoding UTF-8
32              
33             =head1 NAME
34              
35             Code::TidyAll::Plugin::PerlCritic - Use perlcritic with tidyall
36              
37             =head1 VERSION
38              
39             version 0.81
40              
41             =head1 SYNOPSIS
42              
43             In configuration:
44              
45             ; Configure in-line
46             ;
47             [PerlCritic]
48             select = lib/**/*.pm
49             argv = --severity 5 --exclude=nowarnings
50              
51             ; or refer to a .perlcriticrc in the same directory
52             ;
53             [PerlCritic]
54             select = lib/**/*.pm
55             argv = --profile $ROOT/.perlcriticrc
56              
57             =head1 DESCRIPTION
58              
59             Runs L<perlcritic>, a Perl validator, and dies if any problems were found.
60              
61             =head1 INSTALLATION
62              
63             Install perlcritic from CPAN.
64              
65             cpanm perlcritic
66              
67             =head1 CONFIGURATION
68              
69             This plugin accepts the following configuration options:
70              
71             =head2 argv
72              
73             Arguments to pass to C<perlcritic>.
74              
75             =head1 SUPPORT
76              
77             Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>.
78              
79             =head1 SOURCE
80              
81             The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>.
82              
83             =head1 AUTHORS
84              
85             =over 4
86              
87             =item *
88              
89             Jonathan Swartz <swartz@pobox.com>
90              
91             =item *
92              
93             Dave Rolsky <autarch@urth.org>
94              
95             =back
96              
97             =head1 COPYRIGHT AND LICENSE
98              
99             This software is copyright (c) 2011 - 2022 by Jonathan Swartz.
100              
101             This is free software; you can redistribute it and/or modify it under
102             the same terms as the Perl 5 programming language system itself.
103              
104             The full text of the license can be found in the
105             F<LICENSE> file included with this distribution.
106              
107             =cut