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