blib/lib/Code/TidyAll/Plugin/JSLint.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 33 CC 2 SCAR 12.0
CC
2
Cov
0%
validate_file
6.0
_build_cmd
2.0
BEGIN
2.0
CRAP 3.3
1 package Code::TidyAll::Plugin::JSLint;
2  
3 use strict;
4 use warnings;
5  
6 use Moo;
7  
8 extends 'Code::TidyAll::Plugin';
9  
10 with 'Code::TidyAll::Role::RunsCommand';
11  
12 has '+ok_exit_codes' => (
13 default => sub { [ 0, 1 ] },
14 );
15  
16 our $VERSION = '0.83';
17  
18 sub _build_cmd {'jslint'}
19  
20 sub validate_file {
21 my ( $self, $file ) = @_;
22  
23 my $output = $self->_run_or_die($file);
24 die "$output\n" if $output =~ /\S/ && $output !~ /.+ is OK\./;
25  
26 return;
27 }
28  
29 1;
30  
31 # ABSTRACT: Use jslint with tidyall
32  
33 __END__
34  
35 =pod
36  
37 =encoding UTF-8
38  
39 =head1 NAME
40  
41 Code::TidyAll::Plugin::JSLint - Use jslint with tidyall
42  
43 =head1 VERSION
44  
45 version 0.83
46  
47 =head1 SYNOPSIS
48  
49 In configuration:
50  
51 [JSLint]
52 select = static/**/*.js
53 argv = --white --vars --regex
54  
55 =head1 DESCRIPTION
56  
57 Runs L<jslint|http://www.jslint.com/>, a JavaScript validator, and dies if any
58 problems were found.
59  
60 =head1 INSTALLATION
61  
62 Install L<npm|https://npmjs.org/>, then run
63  
64 npm install jslint
65  
66 =head1 CONFIGURATION
67  
68 This plugin accepts the following configuration options:
69  
70 =head2 argv
71  
72 Arguments to pass to C<jslint>.
73  
74 =head2 cmd
75  
76 The path for the C<jslint> command. By default this is just C<jslint>, meaning
77 that the user's C<PATH> will be searched for the command.
78  
79 =head1 SUPPORT
80  
81 Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>.
82  
83 =head1 SOURCE
84  
85 The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>.
86  
87 =head1 AUTHORS
88  
89 =over 4
90  
91 =item *
92  
93 Jonathan Swartz <swartz@pobox.com>
94  
95 =item *
96  
97 Dave Rolsky <autarch@urth.org>
98  
99 =back
100  
101 =head1 COPYRIGHT AND LICENSE
102  
103 This software is copyright (c) 2011 - 2022 by Jonathan Swartz.
104  
105 This is free software; you can redistribute it and/or modify it under
106 the same terms as the Perl 5 programming language system itself.
107  
108 The full text of the license can be found in the
109 F<LICENSE> file included with this distribution.
110  
111 =cut