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

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