line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
461
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
11
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
5
|
|
|
|
|
|
|
use Moo; |
6
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
extends 'Code::TidyAll::Plugin'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Code::TidyAll::Role::GenericExecutable'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.82'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
my $file = shift; |
15
|
5
|
|
|
5
|
1
|
11
|
|
16
|
5
|
|
|
|
|
25
|
my $output = $self->_run_generic_executable_or_die($file); |
17
|
|
|
|
|
|
|
$file->spew_raw($output); |
18
|
5
|
|
|
|
|
29
|
|
19
|
4
|
|
|
|
|
115
|
return; |
20
|
|
|
|
|
|
|
} |
21
|
4
|
|
|
|
|
4006
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# ABSTRACT: A plugin to run any executable as a transformer |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=encoding UTF-8 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Code::TidyAll::Plugin::GenericTransformer - A plugin to run any executable as a transformer |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 VERSION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
version 0.82 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# In your tidyall config |
42
|
|
|
|
|
|
|
[GenericTransformer / JSONOrderedTidy] |
43
|
|
|
|
|
|
|
cmd = json-ordered-tidy |
44
|
|
|
|
|
|
|
argv = -stdout |
45
|
|
|
|
|
|
|
ok_exit_codes = 0 1 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This plugin allows you to define any executable as a transformer. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 CONFIGURATION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This plugin accepts the following configuration options: |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 cmd |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This is the command to be run. This is required. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 argv |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This is a string containing additional arguments to be passed to the command. |
62
|
|
|
|
|
|
|
These arguments will always be passed. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 file_flag |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is the flag used to tell the command what file to operate on, if it has |
67
|
|
|
|
|
|
|
one. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
By default, the file is simply passed as the last argument. However, many |
70
|
|
|
|
|
|
|
commands will want this passed with a flag like C<-f>, C<--file>, or |
71
|
|
|
|
|
|
|
C<--input>. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 ok_exit_codes |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
By default, any exit code other than C<0> is considered an exception. However, |
76
|
|
|
|
|
|
|
many commands use their exit code to indicate that there was a validation issue |
77
|
|
|
|
|
|
|
as opposed to an exception. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
You can specify multiple exit codes either by listing C<ok_exit_codes> multiple |
80
|
|
|
|
|
|
|
times or as a space-separate list. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SUPPORT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SOURCE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 AUTHORS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=over 4 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Jonathan Swartz <swartz@pobox.com> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is copyright (c) 2011 - 2022 by Jonathan Swartz. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The full text of the license can be found in the |
112
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |