Skip to content

Commit 834572b

Browse files
authored
Merge pull request #18 from metacpan/mickey/tidy
tidy
2 parents 26d1803 + 008c6eb commit 834572b

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

bin/contributor.pl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,33 @@
1616
my $all = 0;
1717
my ( $distribution, $release, $age );
1818
GetOptions(
19-
"all" => \$all,
19+
"all" => \$all,
2020
"distribution=s" => \$distribution,
21-
"release=s" => \$release,
22-
"age=i" => \$age,
21+
"release=s" => \$release,
22+
"age=i" => \$age,
2323
);
2424

2525
# Setup
2626
my $query
27-
= $all ? { match_all => {} }
28-
: $distribution
29-
? { term => { distribution => $distribution } }
30-
: $release ? {
31-
bool => {
32-
must => [
33-
{ term => { author => get_author($release) } },
34-
{ term => { name => $release } },
35-
]
36-
}
27+
= $all ? { match_all => {} }
28+
: $distribution ? { term => { distribution => $distribution } }
29+
: $release ? {
30+
bool => {
31+
must => [
32+
{ term => { author => get_author($release) } },
33+
{ term => { name => $release } },
34+
]
3735
}
38-
: $age
39-
? { range => { date => { gte => sprintf( 'now-%dd', $age ) } } }
40-
: die "Error: must provide 'all' or 'distribution' or 'release' or 'age'";
36+
}
37+
: $age ? { range => { date => { gte => sprintf( 'now-%dd', $age ) } } }
38+
: die "Error: must provide 'all' or 'distribution' or 'release' or 'age'";
4139

42-
my $body = { query => $query };
40+
my $body = { query => $query };
4341
my $timeout = $all ? '720m' : '5m';
44-
my $fields = [qw< author distribution name >];
42+
my $fields = [qw< author distribution name >];
4543

4644
my $es_release = MetaCPAN::ES->new( type => "release" );
47-
my $scroll = $es_release->scroll(
45+
my $scroll = $es_release->scroll(
4846
body => $body,
4947
scroll => $timeout,
5048
fields => $fields,
@@ -64,10 +62,12 @@
6462

6563
###
6664

67-
sub get_author ( $release ) {
65+
sub get_author ($release) {
6866
return unless $release;
6967
my $author = $release =~ s{/.*$}{}r;
70-
$author or die "Error: invalid 'release' argument (format: PAUSEID/DISTRIBUTION-VERSION)";
68+
$author
69+
or die
70+
"Error: invalid 'release' argument (format: PAUSEID/DISTRIBUTION-VERSION)";
7171
return $author;
7272
}
7373

bin/cover.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
my ( $json_file, $test );
1919
GetOptions(
2020
"json=s" => \$json_file,
21-
"test" => \$test
21+
"test" => \$test
2222
);
2323
my $cover_url //= 'http://cpancover.com/latest/cpancover.json';
2424
my $cover_dev_url //= 'http://cpancover.com/latest/cpancover_dev.json';

lib/MetaCPAN/File.pm

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,15 @@ sub add_documentation ($self) {
239239

240240
# This is a Pod file, return its name
241241
$val = $doc
242-
if !$val and $doc and $self->_is_perl_file();
242+
if !$val
243+
and $doc
244+
and $self->_is_perl_file();
243245

244246
# OR: found an indexed module with the same name
245247
$val = $doc
246-
if !$val and $doc and grep { $_->{name} eq $doc } @indexed;
248+
if !$val
249+
and $doc
250+
and grep { $_->{name} eq $doc } @indexed;
247251

248252
# OR: found an indexed module with a name
249253
if ( !$val and my ($mod) = grep { defined $_->{name} } @indexed ) {
@@ -254,11 +258,13 @@ sub add_documentation ($self) {
254258
$val = $doc if !$val and defined $doc;
255259

256260
# OR: found ANY module with a name (better than nothing)
257-
if ( !$val and my ($mod) = grep { defined $_->{name} } @{ $self->{modules} } ) {
261+
if ( !$val
262+
and my ($mod) = grep { defined $_->{name} } @{ $self->{modules} } )
263+
{
258264
return $mod->{name};
259265
}
260266

261-
$self->{documentation} = $val;
267+
$self->{documentation} = $val;
262268
$self->{documentation_length} = length($val);
263269

264270
return undef;

0 commit comments

Comments
 (0)