line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Code::TidyAll::Plugin::PgFormatter; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
13848
|
use IPC::Run3 qw( run3 ); |
|
1
|
|
|
|
|
24086
|
|
|
1
|
|
|
|
|
48
|
|
6
|
1
|
|
|
1
|
|
444
|
use Moo; |
|
1
|
|
|
|
|
9401
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'Code::TidyAll::Plugin'; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
|
|
sub _build_cmd { 'pg_format' } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub transform_source { |
13
|
0
|
|
|
0
|
1
|
|
my ( $self, $source ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# want pg_format to run from stdin |
16
|
0
|
|
|
|
|
|
my @cmd = ( $self->cmd, split(/\s+/, $self->argv ), q{-} ); |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $output; |
19
|
|
|
|
|
|
|
my $err; |
20
|
0
|
|
|
|
|
|
run3( \@cmd, \$source, \$output, \$err); |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if ( $? > 0 ) { |
23
|
0
|
|
0
|
|
|
|
$err ||= "problem running " . $self->cmd; |
24
|
0
|
|
|
|
|
|
die $err; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $output; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |