File Coverage

blib/lib/Code/TidyAll/Plugin/GenericValidator.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 18 18 100.0


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