Skip to content

Commit 526f702

Browse files
committed
tidy
1 parent 57a3174 commit 526f702

File tree

11 files changed

+74
-76
lines changed

11 files changed

+74
-76
lines changed

bin/backpan.pl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ()
4040
my $scroll = $es_release->scroll(
4141
body => {
4242
%{ get_release_query() },
43-
size => 500,
43+
size => 500,
4444
_source => [qw< author archive name >],
4545
},
4646
);
@@ -68,9 +68,7 @@ ()
6868
return +{
6969
query => {
7070
bool => {
71-
must_not => [
72-
{ term => { status => 'backpan' } },
73-
],
71+
must_not => [ { term => { status => 'backpan' } }, ],
7472
},
7573
},
7674
};
@@ -134,7 +132,7 @@ ( $author, $author_releases )
134132
],
135133
},
136134
},
137-
size => 500,
135+
size => 500,
138136
_source => [qw< release >],
139137
},
140138
);

bin/backup.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ sub run_backup {
170170
);
171171
my $scroll = $es->scroll(
172172
scroll => '1m',
173-
body => {
173+
body => {
174174
_source => true,
175-
size => $size,
176-
sort => '_doc',
175+
size => $size,
176+
sort => '_doc',
177177
},
178178
);
179179

bin/check.pl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# look up this module in ElasticSearch and see what we have on it
4040
my $results = $es_file->search(
41-
query => {
41+
query => {
4242
bool => {
4343
must => [
4444
{ term => { 'module.name' => $pkg } },
@@ -47,8 +47,8 @@
4747
],
4848
},
4949
},
50-
size => 100, # shouldn't get more than this
51-
_source => [qw<
50+
size => 100, # shouldn't get more than this
51+
_source => [ qw<
5252
name
5353
release
5454
author
@@ -58,23 +58,26 @@
5858
indexed
5959
maturity
6060
date
61-
>],
61+
> ],
6262

6363
);
6464
my @files = @{ $results->{hits}{hits} };
6565

6666
# now find the first latest releases for these files
6767
foreach my $file (@files) {
6868
my $release_results = $es_release->search(
69-
query => {
69+
query => {
7070
bool => {
7171
must => [
72-
{ term => { name => $file->{_source}{release} } },
72+
{
73+
term =>
74+
{ name => $file->{_source}{release} }
75+
},
7376
{ term => { status => 'latest' } },
7477
],
7578
},
7679
},
77-
size => 1,
80+
size => 1,
7881
_source => [qw< name status authorized version id date >],
7982
);
8083

@@ -87,14 +90,18 @@
8790
if ( !@releases ) {
8891
foreach my $file (@files) {
8992
my $release_results = $es_release->search(
90-
query => {
93+
query => {
9194
bool => {
9295
must => [
93-
{ term => { name => $file->{_source}{release} } },
96+
{
97+
term => {
98+
name => $file->{_source}{release}
99+
}
100+
},
94101
],
95102
},
96103
},
97-
size => 1,
104+
size => 1,
98105
_source =>
99106
[qw< name status authorized version id date >],
100107
);

bin/cve.pl

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,32 +135,28 @@
135135
if (@filters) {
136136
my $query = {
137137
bool => {
138-
must => [
139-
{ term => { distribution => $dist } }, @filters,
140-
]
138+
must =>
139+
[ { term => { distribution => $dist } }, @filters, ]
141140
}
142141
};
143142

144143
my $releases = $es->search(
145-
index => 'cpan',
146-
type => 'release',
147-
body => {
148-
query => $query,
144+
index => 'cpan',
145+
type => 'release',
146+
body => {
147+
query => $query,
149148
_source => [qw< version name author >],
150-
size => 2000,
149+
size => 2000,
151150
},
152151
);
153152

154153
if ( $releases->{hits}{total} ) {
155154
## no critic (ControlStructures::ProhibitMutatingListFunctions)
156155
@matches = map { $_->[0] }
157156
sort { $a->[1] <=> $b->[1] }
158-
map {
159-
[
160-
$_->{_source},
161-
numify_version( $_->{_source}{version} )
162-
]
163-
} @{ $releases->{hits}{hits} };
157+
map { [ $_->{_source},
158+
numify_version( $_->{_source}{version} ) ] }
159+
@{ $releases->{hits}{hits} };
164160
}
165161
else {
166162
log_debug {

bin/favorite.pl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ ()
5555
my $favs = $es->scroll(
5656
scroll => '5m',
5757
body => {
58-
query => $age_filter,
58+
query => $age_filter,
5959
_source => [qw< distribution >],
60-
size => $limit || 500,
61-
sort => '_doc',
60+
size => $limit || 500,
61+
sort => '_doc',
6262
}
6363
);
6464

@@ -87,11 +87,11 @@ ()
8787
my $es = MetaCPAN::ES->new( type => "favorite" );
8888
my $favs = $es->scroll(
8989
scroll => '30s',
90-
body => {
91-
query => $query,
90+
body => {
91+
query => $query,
9292
_source => [qw< distribution >],
93-
size => 500,
94-
sort => '_doc',
93+
size => 500,
94+
sort => '_doc',
9595
},
9696
);
9797

@@ -126,8 +126,8 @@ ()
126126
},
127127
},
128128
_source => [qw< id distribution >],
129-
size => 500,
130-
sort => '_doc',
129+
size => 500,
130+
sort => '_doc',
131131

132132
},
133133
);
@@ -189,8 +189,8 @@ ()
189189
my $files = $es->scroll(
190190
scroll => '15s',
191191
body => {
192-
query => { term => { distribution => $dist } }
193-
_source => false,
192+
query => { term => { distribution => $dist } } _source =>
193+
false,
194194
size => 500,
195195
sort => '_doc',
196196
},

bin/latest.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ ($filter)
238238
]
239239
}
240240
},
241-
},
241+
},
242+
;
242243
}
243244

244245
sub _queue_latest ( $dist = $distribution ) {
@@ -260,7 +261,7 @@ ( $es, $author, $name )
260261
{ term => { name => $name } },
261262
]
262263
},
263-
size => 500,
264+
size => 500,
264265
_source => [qw< id name >],
265266
},
266267
},
@@ -325,13 +326,12 @@ ( $bulk, $source, $status )
325326
bool => {
326327
must => [
327328
{
328-
term =>
329-
{ 'release' => $source->{release} }
329+
term => { 'release' => $source->{release} }
330330
},
331331
{ term => { 'author' => $source->{author} } },
332332
],
333333
},
334-
size => 500,
334+
size => 500,
335335
_source => [qw< name >],
336336
},
337337
},

bin/release.pl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,17 @@ ($document)
426426
my $count = $es->search(
427427
search_type => 'count',
428428
body => {
429-
query => {
429+
query => {
430430
bool => {
431431
must => [
432-
{ term => { distribution => $document->{distribution} } },
432+
{
433+
term =>
434+
{ distribution => $document->{distribution} }
435+
},
433436
{
434437
range => {
435438
version_numified =>
436-
{ 'lt' => $document->{version_numified} }
439+
{ 'lt' => $document->{version_numified} }
437440
},
438441
},
439442
],

bin/suggest.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ ($range)
7373
}
7474
},
7575
_source => [qw< id documentation >],
76-
size => 500,
77-
sort => '_doc',
76+
size => 500,
77+
sort => '_doc',
7878
},
7979
);
8080

@@ -89,8 +89,8 @@ ($range)
8989
id => $file->{_id},
9090
doc => {
9191
suggest => {
92-
input => [$documentation],
93-
weight => $weight,
92+
input => [$documentation],
93+
weight => $weight,
9494
},
9595
},
9696
} );

bin/tickets.pl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@
4545
sub check_all_distributions () {
4646
my $es_release = MetaCPAN::ES->new( type => "release" );
4747
my $scroll_release = $es_release->scroll(
48-
body => {
48+
body => {
4949
query => {
5050
bool => {
51-
must_not => [
52-
{ term => { status => 'backpan' } },
53-
],
51+
must_not => [ { term => { status => 'backpan' } }, ],
5452
},
5553
},
56-
size => 500,
54+
size => 500,
5755
_source => [qw< distribution >],
5856
},
5957
);
@@ -138,13 +136,13 @@ ()
138136
{
139137
prefix => {
140138
"resources.bugtracker.web" =>
141-
'http://github.com/'
139+
'http://github.com/'
142140
},
143141
},
144142
{
145143
prefix => {
146144
"resources.bugtracker.web" =>
147-
'https://github.com/'
145+
'https://github.com/'
148146
},
149147
},
150148
],

bin/watcher.pl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,10 @@ ()
9898
body => {
9999
query => {
100100
bool => {
101-
must_not => [
102-
{ term => { status => 'backpan' } }
103-
],
101+
must_not => [ { term => { status => 'backpan' } } ],
104102
},
105103
},
106-
size => 1000,
104+
size => 1000,
107105
_source => [qw< author archive >],
108106
},
109107
);
@@ -166,7 +164,7 @@ ($info)
166164
my $scroll_release = $es_release->scroll(
167165
scroll => '1m',
168166
body => {
169-
query => {
167+
query => {
170168
bool => {
171169
must => [
172170
{ term => { author => $info->cpanid } },
@@ -205,9 +203,9 @@ ($release)
205203
],
206204
},
207205
},
208-
size => 1000,
206+
size => 1000,
209207
_source => true,
210-
sort => '_doc',
208+
sort => '_doc',
211209
},
212210
} );
213211
return if $dry_run;
@@ -220,17 +218,15 @@ ($release)
220218
$bulk_file->index( {
221219
id => $row->{_id},
222220
source => {
223-
%$source,
224-
status => 'backpan',
221+
%$source, status => 'backpan',
225222
}
226223
} );
227224
}
228225

229226
$bulk_release->index( {
230227
id => $release->{_id},
231228
source => {
232-
%{ $release->{_source} },
233-
status => 'backpan',
229+
%{ $release->{_source} }, status => 'backpan',
234230
}
235231
} );
236232

0 commit comments

Comments
 (0)