File Coverage

File:generate-apply.pl
Coverage:96.9%

linestmtbrancondsubtimecode
1#!/usr/bin/env perl
2
1
1
1
1468
6908
521
use JSON::PP;
3sub read_null_delimited_file {
4
2
3
  my ($file) = @_;
5
2
2
  local $/=undef;
6
1
1
1
2
242
6
2
26
  return () unless open my $input, '<:encoding(UTF-8)', $file;
7
2
399
  my @files = split /\0/, <$input>;
8
2
20
  close $input;
9
2
5
  return @files;
10}
11
1
39095
my @expect_files = read_null_delimited_file $ENV{expect_files};
12
1
2
my @excludes_files = read_null_delimited_file $ENV{excludes_files};
13
1
1
my $new_expect_file = $ENV{new_expect_file};
14
1
2
my $excludes_file = $ENV{excludes_file};
15
1
1
my $spelling_config = $ENV{spelling_config};
16
1
2
my $job = $ENV{THIS_GITHUB_JOB_ID};
17
1
1
$config{"excludes_file"} = $excludes_file;
18
1
1
$config{"new_expect_file"} = $new_expect_file;
19
1
2
$config{"spelling_config"} = $spelling_config;
20
1
1
$config{"expect_files"} = \@expect_files;
21
1
2
$config{"excludes_files"} = \@excludes_files;
22
1
1
$config{"job"} = $job;
23
1
1
$config{"only_check_changed_files"} = $ENV{INPUT_ONLY_CHECK_CHANGED_FILES};
24
1
2
my $json_canonical = JSON::PP->new->canonical([1]);
25
1
24
print $json_canonical->utf8->encode(\%config);