diff --git a/app.psgi b/app.psgi index ac85e6a78..5ee9aa30d 100644 --- a/app.psgi +++ b/app.psgi @@ -8,7 +8,7 @@ BEGIN { } use lib "$root_dir/lib"; -use Config::ZOMG; +use Config::ZOMG (); use File::Path (); use File::Spec (); use Log::Log4perl (); @@ -46,7 +46,7 @@ BEGIN { $SIG{__WARN__} = sub { $logger->warn(@_) }; } -use MetaCPAN::Server; +use MetaCPAN::Server (); STDERR->autoflush; diff --git a/bin/check_json.pl b/bin/check_json.pl index 491d2d5be..f798368d2 100755 --- a/bin/check_json.pl +++ b/bin/check_json.pl @@ -2,8 +2,8 @@ # PODNAME: check_json.pl use 5.010; -use Data::Dumper; -use Cpanel::JSON::XS; +use Data::Dumper qw( Dumper ); +use Cpanel::JSON::XS qw( decode_json ); foreach my $file (@ARGV) { say "Processing $file"; diff --git a/bin/convert_authors.pl b/bin/convert_authors.pl index 68c98ca0b..adaa5a0e6 100644 --- a/bin/convert_authors.pl +++ b/bin/convert_authors.pl @@ -2,8 +2,8 @@ use strict; use warnings; -use Cpanel::JSON::XS; -use File::Find; +use Cpanel::JSON::XS qw( decode_json ); +use File::Find qw( find ); my @files; find( diff --git a/bin/metacpan b/bin/metacpan index d952e2411..e57c34fdb 100755 --- a/bin/metacpan +++ b/bin/metacpan @@ -14,9 +14,9 @@ use strict; use warnings; -use FindBin; +use FindBin (); use lib "$FindBin::RealBin/../lib"; -use MetaCPAN::Script::Runner; +use MetaCPAN::Script::Runner (); MetaCPAN::Script::Runner->run; diff --git a/bin/unlisted_prereqs.pl b/bin/unlisted_prereqs.pl index ae6a0829e..8ab857aaf 100644 --- a/bin/unlisted_prereqs.pl +++ b/bin/unlisted_prereqs.pl @@ -6,9 +6,9 @@ use strict; use warnings; use Perl::PrereqScanner 1.014; -use CPAN::Meta::Requirements; +use CPAN::Meta::Requirements (); use File::Find::Rule::Perl; -use List::Util qw(sum); +use List::Util qw( sum ); use version 0.77; # TODO: use CPAN::Meta::Prereqs @@ -91,7 +91,7 @@ sub check_prereqs { if version->parse( $reqs->{runtime}{perl} ) <= version->parse($MIN_PERL_VERSION); -use Data::Dumper; +use Data::Dumper (); $Data::Dumper::Sortkeys = 1; print Data::Dumper->Dump( [$reqs], ['requires'] ); diff --git a/cpanfile b/cpanfile index a75d5124b..6259ecd45 100644 --- a/cpanfile +++ b/cpanfile @@ -154,7 +154,7 @@ requires 'Module::Faker::Dist', '== 0.017'; requires 'OrePAN2', '0.48'; requires 'Parallel::ForkManager' => '2.02'; requires 'Perl::Critic', '0.140'; -requires 'Perl::Tidy' => '== 20230309'; +requires 'Perl::Tidy' => '== 20240511'; requires 'PPI', '1.274'; # Perl::Critic requires 'PPIx::QuoteLike', '0.022'; # Perl::Critic requires 'PPIx::Regexp', '0.085'; # Perl::Critic diff --git a/cpanfile.snapshot b/cpanfile.snapshot index 0a6cc3343..3c1405132 100644 --- a/cpanfile.snapshot +++ b/cpanfile.snapshot @@ -24,6 +24,58 @@ DISTRIBUTIONS POSIX::strftime::Compiler 0.30 Time::Local 0 perl 5.008001 + App-perlimports-0.000055 + pathname: O/OA/OALDERS/App-perlimports-0.000055.tar.gz + provides: + App::perlimports 0.000055 + App::perlimports::Annotations 0.000055 + App::perlimports::CLI 0.000055 + App::perlimports::Config 0.000055 + App::perlimports::Document 0.000055 + App::perlimports::ExportInspector 0.000055 + App::perlimports::Include 0.000055 + App::perlimports::Role::Logger 0.000055 + App::perlimports::Sandbox 0.000055 + requirements: + Capture::Tiny 0 + Class::Inspector 1.36 + Cpanel::JSON::XS 0 + Data::Dumper 0 + Data::UUID 0 + ExtUtils::MakeMaker 0 + File::Basename 0 + File::XDG 1.01 + Getopt::Long::Descriptive 0 + List::Util 0 + Log::Dispatch 2.70 + Memoize 0 + Module::Runtime 0 + Moo 0 + Moo::Role 0 + MooX::StrictConstructor 0 + PPI 1.276 + PPI::Document 0 + PPIx::Utils::Classification 0 + Path::Iterator::Rule 0 + Path::Tiny 0 + Perl::Tidy 20220613 + Pod::Usage 0 + Ref::Util 0 + Scalar::Util 0 + Sereal::Decoder 0 + Sereal::Encoder 0 + Sub::HandlesVia 0 + Symbol::Get 0.10 + TOML::Tiny 0.16 + Text::Diff 0 + Text::SimpleTable::AutoWidth 0 + Try::Tiny 0 + Types::Standard 0 + feature 0 + perl v5.18.0 + strict 0 + utf8 0 + warnings 0 Archive-Any-0.0946 pathname: O/OA/OALDERS/Archive-Any-0.0946.tar.gz provides: @@ -332,6 +384,13 @@ DISTRIBUTIONS Test::More 0.88 Test::Requires 0 perl 5.008001 + Call-Context-0.05 + pathname: F/FE/FELIPE/Call-Context-0.05.tar.gz + provides: + Call::Context 0.05 + Call::Context::X 0.05 + requirements: + ExtUtils::MakeMaker 0 Canary-Stability-2013 pathname: M/ML/MLEHMANN/Canary-Stability-2013.tar.gz provides: @@ -1733,6 +1792,16 @@ DISTRIBUTIONS perl 5.008004 strict 0 warnings 0 + Devel-CheckLib-1.16 + pathname: M/MA/MATTN/Devel-CheckLib-1.16.tar.gz + provides: + Devel::CheckLib 1.16 + requirements: + Exporter 0 + ExtUtils::MakeMaker 0 + File::Spec 0 + File::Temp 0.16 + perl 5.004050 Devel-Confess-0.009004 pathname: H/HA/HAARG/Devel-Confess-0.009004.tar.gz provides: @@ -2375,6 +2444,16 @@ DISTRIBUTIONS ExtUtils::MakeMaker 0 base 0 perl 5.006 + File-XDG-1.03 + pathname: P/PL/PLICEASE/File-XDG-1.03.tar.gz + provides: + File::XDG 1.03 + requirements: + ExtUtils::MakeMaker 0 + File::Path 2.07 + Path::Tiny 0 + Ref::Util 0 + perl 5.006 File-pushd-1.016 pathname: D/DA/DAGOLDEN/File-pushd-1.016.tar.gz provides: @@ -5674,27 +5753,23 @@ DISTRIBUTIONS strict 0 version 0.77 warnings 0 - Perl-Tidy-20230309 - pathname: S/SH/SHANCOCK/Perl-Tidy-20230309.tar.gz - provides: - Perl::Tidy 20230309 - Perl::Tidy::Debugger 20230309 - Perl::Tidy::DevNull 20230309 - Perl::Tidy::Diagnostics 20230309 - Perl::Tidy::FileWriter 20230309 - Perl::Tidy::Formatter 20230309 - Perl::Tidy::HtmlWriter 20230309 - Perl::Tidy::IOScalar 20230309 - Perl::Tidy::IOScalarArray 20230309 - Perl::Tidy::IndentationItem 20230309 - Perl::Tidy::LineBuffer 20230309 - Perl::Tidy::LineSink 20230309 - Perl::Tidy::LineSource 20230309 - Perl::Tidy::Logger 20230309 - Perl::Tidy::Tokenizer 20230309 - Perl::Tidy::VerticalAligner 20230309 - Perl::Tidy::VerticalAligner::Alignment 20230309 - Perl::Tidy::VerticalAligner::Line 20230309 + Perl-Tidy-20240511 + pathname: S/SH/SHANCOCK/Perl-Tidy-20240511.tar.gz + provides: + Perl::Tidy 20240511 + Perl::Tidy::Debugger 20240511 + Perl::Tidy::Diagnostics 20240511 + Perl::Tidy::FileWriter 20240511 + Perl::Tidy::Formatter 20240511 + Perl::Tidy::HtmlWriter 20240511 + Perl::Tidy::IOScalar 20240511 + Perl::Tidy::IOScalarArray 20240511 + Perl::Tidy::IndentationItem 20240511 + Perl::Tidy::Logger 20240511 + Perl::Tidy::Tokenizer 20240511 + Perl::Tidy::VerticalAligner 20240511 + Perl::Tidy::VerticalAligner::Alignment 20240511 + Perl::Tidy::VerticalAligner::Line 20240511 requirements: ExtUtils::MakeMaker 0 perl 5.008 @@ -6215,6 +6290,51 @@ DISTRIBUTIONS overload 0 strict 0 warnings 0 + Sereal-Decoder-5.004 + pathname: Y/YV/YVES/Sereal-Decoder-5.004.tar.gz + provides: + Sereal::Decoder 5.004 + Sereal::Decoder::Constants 5.004 + Sereal::Performance undef + requirements: + Data::Dumper 0 + Devel::CheckLib 1.16 + ExtUtils::MakeMaker 7.0 + ExtUtils::ParseXS 2.21 + File::Find 0 + File::Path 0 + File::Spec 0 + Scalar::Util 0 + Test::Deep 0 + Test::Differences 0 + Test::LongString 0 + Test::More 0.88 + Test::Warn 0 + XSLoader 0 + perl 5.008 + Sereal-Encoder-5.004 + pathname: Y/YV/YVES/Sereal-Encoder-5.004.tar.gz + provides: + Sereal::Encoder 5.004 + Sereal::Encoder::Constants 5.004 + requirements: + Data::Dumper 0 + Devel::CheckLib 1.16 + ExtUtils::MakeMaker 7.0 + ExtUtils::ParseXS 2.21 + File::Find 0 + File::Path 0 + File::Spec 0 + Hash::Util 0 + Scalar::Util 0 + Sereal::Decoder 5.004 + Test::Deep 0 + Test::Differences 0 + Test::LongString 0 + Test::More 0.88 + Test::Warn 0 + XSLoader 0 + perl 5.008 Sort-Versions-1.62 pathname: N/NE/NEILB/Sort-Versions-1.62.tar.gz provides: @@ -6384,6 +6504,47 @@ DISTRIBUTIONS Sub::Exporter::Progressive 0.001013 requirements: ExtUtils::MakeMaker 0 + Sub-HandlesVia-0.050000 + pathname: T/TO/TOBYINK/Sub-HandlesVia-0.050000.tar.gz + provides: + Sub::HandlesVia 0.050000 + Sub::HandlesVia::CodeGenerator 0.050000 + Sub::HandlesVia::Declare 0.050000 + Sub::HandlesVia::Handler 0.050000 + Sub::HandlesVia::Handler::CodeRef 0.050000 + Sub::HandlesVia::Handler::Traditional 0.050000 + Sub::HandlesVia::HandlerLibrary 0.050000 + Sub::HandlesVia::HandlerLibrary::Array 0.050000 + Sub::HandlesVia::HandlerLibrary::Blessed 0.050000 + Sub::HandlesVia::HandlerLibrary::Bool 0.050000 + Sub::HandlesVia::HandlerLibrary::Code 0.050000 + Sub::HandlesVia::HandlerLibrary::Counter 0.050000 + Sub::HandlesVia::HandlerLibrary::Enum 0.050000 + Sub::HandlesVia::HandlerLibrary::Hash 0.050000 + Sub::HandlesVia::HandlerLibrary::Number 0.050000 + Sub::HandlesVia::HandlerLibrary::Scalar 0.050000 + Sub::HandlesVia::HandlerLibrary::String 0.050000 + Sub::HandlesVia::Mite undef + Sub::HandlesVia::Toolkit 0.050000 + Sub::HandlesVia::Toolkit::Mite 0.050000 + Sub::HandlesVia::Toolkit::Moo 0.050000 + Sub::HandlesVia::Toolkit::Moose 0.050000 + Sub::HandlesVia::Toolkit::Moose::PackageTrait 0.050000 + Sub::HandlesVia::Toolkit::Moose::RoleTrait 0.050000 + Sub::HandlesVia::Toolkit::Mouse 0.050000 + Sub::HandlesVia::Toolkit::Mouse::PackageTrait 0.050000 + Sub::HandlesVia::Toolkit::Mouse::RoleTrait 0.050000 + Sub::HandlesVia::Toolkit::ObjectPad 0.050000 + Sub::HandlesVia::Toolkit::Plain 0.050000 + requirements: + Class::Method::Modifiers 0 + Exporter::Shiny 0 + ExtUtils::MakeMaker 6.17 + List::Util 1.54 + Role::Hooks 0.008 + Role::Tiny 0 + Type::Tiny 1.004 + perl 5.008001 Sub-Identify-0.14 pathname: R/RG/RGARCIA/Sub-Identify-0.14.tar.gz provides: @@ -6434,6 +6595,13 @@ DISTRIBUTIONS perl 5.006 strict 0 warnings 0 + Symbol-Get-0.12 + pathname: F/FE/FELIPE/Symbol-Get-0.12.tar.gz + provides: + Symbol::Get 0.12 + requirements: + Call::Context 0 + ExtUtils::MakeMaker 0 System-Sub-0.162800 pathname: D/DO/DOLMEN/System-Sub-0.162800.tar.gz provides: @@ -6451,6 +6619,23 @@ DISTRIBUTIONS perl 5.006 strict 0 warnings 0 + TOML-Tiny-0.17 + pathname: O/OA/OALDERS/TOML-Tiny-0.17.tar.gz + provides: + TOML::Tiny 0.17 + TOML::Tiny::Grammar 0.17 + TOML::Tiny::Parser 0.17 + TOML::Tiny::Tokenizer 0.17 + TOML::Tiny::Util 0.17 + TOML::Tiny::Writer 0.17 + requirements: + Carp 0 + Data::Dumper 0 + Encode 0 + Exporter 0 + ExtUtils::MakeMaker 0 + Math::BigInt 1.999718 + perl 5.018 Task-Weaken-1.06 pathname: E/ET/ETHER/Task-Weaken-1.06.tar.gz provides: @@ -6618,6 +6803,14 @@ DISTRIBUTIONS Try::Tiny 0.07 strict 0 warnings 0 + Test-LongString-0.17 + pathname: R/RG/RGARCIA/Test-LongString-0.17.tar.gz + provides: + Test::LongString 0.17 + requirements: + ExtUtils::MakeMaker 0 + Test::Builder 0.12 + Test::Builder::Tester 1.04 Test-MockRandom-1.01 pathname: D/DA/DAGOLDEN/Test-MockRandom-1.01.tar.gz provides: @@ -6799,6 +6992,17 @@ DISTRIBUTIONS ExtUtils::MakeMaker 0 Test::More 0 perl 5.008001 + Text-SimpleTable-AutoWidth-0.09 + pathname: C/CU/CUB/Text-SimpleTable-AutoWidth-0.09.tar.gz + provides: + Text::SimpleTable::AutoWidth 0.09 + requirements: + ExtUtils::MakeMaker 0 + List::Util 0 + Moo 0 + Text::SimpleTable 0 + strict 0 + warnings 0 Text-Template-1.61 pathname: M/MS/MSCHOUT/Text-Template-1.61.tar.gz provides: diff --git a/etc/metacpan.pl b/etc/metacpan.pl index 12c2af5f7..23f63d77b 100644 --- a/etc/metacpan.pl +++ b/etc/metacpan.pl @@ -6,10 +6,13 @@ # ElasticSearch instance, can be either a single server # or an arrayref of servers es => ':9200', + # the port of the api server port => '5000', + # log level level => 'info', + # appender for Log4perl # default layout is "%d %p{1} %c: %m{chomp}%n" # can be overridden using the layout key @@ -17,13 +20,17 @@ # override and not append to this configuration logger => [ { - class => 'Log::Log4perl::Appender::File', + class => 'Log::Log4perl::Appender::File', filename => $FindBin::RealBin . '/../var/log/metacpan.log', syswrite => 1, }, - (-t *STDERR ? ({ - class => 'Log::Log4perl::Appender::ScreenColoredLevels', - stdout => 0, - }) : ()), + ( + -t *STDERR + ? ( { + class => 'Log::Log4perl::Appender::ScreenColoredLevels', + stdout => 0, + } ) + : () + ), ], } diff --git a/etc/metacpan_testing.pl b/etc/metacpan_testing.pl index a56f70d5a..819bcb0e1 100644 --- a/etc/metacpan_testing.pl +++ b/etc/metacpan_testing.pl @@ -1,12 +1,12 @@ { - es => ($ENV{ES_TEST} || 'localhost:9900'), - port => '5900', + es => ( $ENV{ES_TEST} || 'localhost:9900' ), + port => '5900', die_on_error => 1, - level => ($ENV{TEST_VERBOSE} ? 'info' : 'warn'), - cpan => 'var/t/tmp/fakecpan', - source_base => 'var/t/tmp/source', - logger => [{ + level => ( $ENV{TEST_VERBOSE} ? 'info' : 'warn' ), + cpan => 'var/t/tmp/fakecpan', + source_base => 'var/t/tmp/source', + logger => [ { class => 'Log::Log4perl::Appender::Screen', - name => 'testing' - }] + name => 'testing' + } ] } diff --git a/improve-search-results/app.pl b/improve-search-results/app.pl index 9d9d1fc5f..6567c6fba 100755 --- a/improve-search-results/app.pl +++ b/improve-search-results/app.pl @@ -1,9 +1,9 @@ use Mojolicious::Lite; use Mojo::Pg; -use List::Util qw(first); +use List::Util qw( first ); -my $user = getpwuid($<); # for vagrant user on dev box +my $user = getpwuid($<); # for vagrant user on dev box # carton exec /opt/perl-5.22.2/bin/perl ./app.pl daemon -m production -l http://*:5000 @@ -12,22 +12,22 @@ app->pg->auto_migrate(1)->migrations->from_data; helper insert_search => sub { - my ($c, $search, $expect) = @_; - return !!$c->pg->db->query(<<' SQL', $search, $expect)->rows; + my ( $c, $search, $expect ) = @_; + return !!$c->pg->db->query( <<' SQL', $search, $expect )->rows; insert into searches (search, expect) values (?, ?) SQL }; helper insert_source => sub { - my ($c, $name, $query) = @_; - return !!$c->pg->db->query(<<' SQL', $name, $query)->rows; + my ( $c, $name, $query ) = @_; + return !!$c->pg->db->query( <<' SQL', $name, $query )->rows; insert into sources (name, query) values (?, ?, ?) SQL }; helper get_results => sub { - my $c = shift; - return $c->pg->db->query(<<' SQL')->expand->hash->{results}; + my $c = shift; + return $c->pg->db->query(<<' SQL')->expand->hash->{results}; select json_object_agg(search, results) as results from ( select @@ -42,8 +42,8 @@ }; helper perform_all_searches => sub { - my ($c) = @_; - my $queries = $c->pg->db->query(<<' SQL'); + my ($c) = @_; + my $queries = $c->pg->db->query(<<' SQL'); select searches.id as search_id, sources.id as source_id, @@ -56,54 +56,58 @@ left join results on searches.id = results.search_id and sources.id = results.source_id SQL - my $db = $c->pg->db; - my $sql = 'insert into results (search_id, source_id, rank) values (?, ?, ?)'; - $queries->hashes->each(sub{ - my $query = shift; - return if $query->{rank}; - my $rank = $c->perform_one_search(@{$query}{qw/search expect name query/}); - $db->query($sql, @{$query}{qw/search_id source_id/}, $rank); - }); + my $db = $c->pg->db; + my $sql + = 'insert into results (search_id, source_id, rank) values (?, ?, ?)'; + $queries->hashes->each( sub { + my $query = shift; + return if $query->{rank}; + my $rank = $c->perform_one_search( + @{$query}{qw/search expect name query/} ); + $db->query( $sql, @{$query}{qw/search_id source_id/}, $rank ); + } ); }; helper perform_one_search => sub { - my ($c, $search, $expect, $name, $query) = @_; + my ( $c, $search, $expect, $name, $query ) = @_; - my $rank = - $name eq 'SCO' ? _perform_sco($c, $search, $expect) : - $name eq 'MWEB' ? _perform_mweb($c, $search, $expect) : - _perform_mquery($c, $search, $expect, $query); + my $rank + = $name eq 'SCO' ? _perform_sco( $c, $search, $expect ) + : $name eq 'MWEB' ? _perform_mweb( $c, $search, $expect ) + : _perform_mquery( $c, $search, $expect, $query ); - return $rank // 100; + return $rank // 100; }; sub _perform_sco { - my ($c, $search, $expect) = @_; - my $url = Mojo::URL->new('http://search.cpan.org/search?mode=all&n=100'); - $url->query([query => $search]); - my $tx = $c->app->ua->get($url); - my $res = $tx->res->dom->find('.sr')->map('all_text')->to_array; - my $idx = first { $res->[$_] eq $expect } @{$res->to_array}; - return $idx < 0 ? undef : $idx + 1; + my ( $c, $search, $expect ) = @_; + my $url = Mojo::URL->new('http://search.cpan.org/search?mode=all&n=100'); + $url->query( [ query => $search ] ); + my $tx = $c->app->ua->get($url); + my $res = $tx->res->dom->find('.sr')->map('all_text')->to_array; + my $idx = first { $res->[$_] eq $expect } @{ $res->to_array }; + return $idx < 0 ? undef : $idx + 1; } sub _perform_mweb { - my ($c, $search, $expect) = @_; - my $url = Mojo::URL->new('https://metacpan.org/search?size=100'); - $url->query([q => $search]); - my $tx = $c->app->ua->get($url); - my $res = $tx->res->dom->find('.module-result big strong a')->map('all_text')->to_array; - my $idx = first { $res->[$_] eq $expect } 0 .. $#{$res}; - return $idx < 0 ? undef : $idx + 1; + my ( $c, $search, $expect ) = @_; + my $url = Mojo::URL->new('https://metacpan.org/search?size=100'); + $url->query( [ q => $search ] ); + my $tx = $c->app->ua->get($url); + my $res + = $tx->res->dom->find('.module-result big strong a')->map('all_text') + ->to_array; + my $idx = first { $res->[$_] eq $expect } 0 .. $#{$res}; + return $idx < 0 ? undef : $idx + 1; } -sub _perform_mquery {} +sub _perform_mquery { } get '/' => 'index'; get '/results' => sub { - my $c = shift; - $c->render(json => $c->get_results); + my $c = shift; + $c->render( json => $c->get_results ); }; app->start; diff --git a/lib/Catalyst/Action/Deserialize/MetaCPANSanitizedJSON.pm b/lib/Catalyst/Action/Deserialize/MetaCPANSanitizedJSON.pm index e951b0f8f..e46d7b8e2 100644 --- a/lib/Catalyst/Action/Deserialize/MetaCPANSanitizedJSON.pm +++ b/lib/Catalyst/Action/Deserialize/MetaCPANSanitizedJSON.pm @@ -1,10 +1,10 @@ package Catalyst::Action::Deserialize::MetaCPANSanitizedJSON; use Moose; -use namespace::autoclean; -use Try::Tiny qw( catch try ); use Cpanel::JSON::XS (); use MetaCPAN::Server::QuerySanitizer (); +use namespace::autoclean; +use Try::Tiny qw( catch try ); extends 'Catalyst::Action::Deserialize::JSON'; diff --git a/lib/Catalyst/Authentication/Store/Proxy.pm b/lib/Catalyst/Authentication/Store/Proxy.pm index 1e701b31b..47de4ad83 100644 --- a/lib/Catalyst/Authentication/Store/Proxy.pm +++ b/lib/Catalyst/Authentication/Store/Proxy.pm @@ -2,7 +2,7 @@ package Catalyst::Authentication::Store::Proxy; # ABSTRACT: Delegates authentication logic to the user object use Moose; -use Catalyst::Utils; +use Catalyst::Utils (); use MetaCPAN::Types::TypeTiny qw( HashRef Str ); has user_class => ( diff --git a/lib/Catalyst/Plugin/Session/Store/ElasticSearch.pm b/lib/Catalyst/Plugin/Session/Store/ElasticSearch.pm index f4ec351d7..3ef16430f 100644 --- a/lib/Catalyst/Plugin/Session/Store/ElasticSearch.pm +++ b/lib/Catalyst/Plugin/Session/Store/ElasticSearch.pm @@ -4,7 +4,7 @@ package Catalyst::Plugin::Session::Store::ElasticSearch; use Moose; extends 'Catalyst::Plugin::Session::Store'; -use MooseX::Types::ElasticSearch qw(:all); +use MooseX::Types::ElasticSearch qw( ES ); has _session_es => ( required => 1, diff --git a/lib/MetaCPAN/API/Plugin/Model.pm b/lib/MetaCPAN/API/Plugin/Model.pm index b997f8a5b..8688d5e73 100644 --- a/lib/MetaCPAN/API/Plugin/Model.pm +++ b/lib/MetaCPAN/API/Plugin/Model.pm @@ -8,9 +8,9 @@ use Carp (); use MetaCPAN::Model::Search (); # New models -use MetaCPAN::API::Model::User (); -use MetaCPAN::API::Model::Download (); use MetaCPAN::API::Model::Cover (); +use MetaCPAN::API::Model::Download (); +use MetaCPAN::API::Model::User (); has app => sub { Carp::croak 'app is required' }, weak => 1; diff --git a/lib/MetaCPAN/Document/Author.pm b/lib/MetaCPAN/Document/Author.pm index 1f15e9efd..3f4e18685 100644 --- a/lib/MetaCPAN/Document/Author.pm +++ b/lib/MetaCPAN/Document/Author.pm @@ -3,7 +3,7 @@ package MetaCPAN::Document::Author; use MetaCPAN::Moose; # load order important for next 2 modules -use ElasticSearchX::Model::Document::Types qw(:all); +use ElasticSearchX::Model::Document::Types qw( Location ); use ElasticSearchX::Model::Document; # load order not important diff --git a/lib/MetaCPAN/Document/Author/Profile.pm b/lib/MetaCPAN/Document/Author/Profile.pm index 70132dffe..497828b07 100644 --- a/lib/MetaCPAN/Document/Author/Profile.pm +++ b/lib/MetaCPAN/Document/Author/Profile.pm @@ -8,8 +8,8 @@ use ElasticSearchX::Model::Document; with 'ElasticSearchX::Model::Document::EmbeddedRole'; -use MetaCPAN::Util; use MetaCPAN::Types::TypeTiny qw( Str ); +use MetaCPAN::Util; has name => ( is => 'ro', diff --git a/lib/MetaCPAN/Document/Favorite.pm b/lib/MetaCPAN/Document/Favorite.pm index 7a13a3bbf..eaf7cbcf1 100644 --- a/lib/MetaCPAN/Document/Favorite.pm +++ b/lib/MetaCPAN/Document/Favorite.pm @@ -6,7 +6,7 @@ use warnings; use Moose; use ElasticSearchX::Model::Document; -use DateTime; +use DateTime (); use MetaCPAN::Util; has id => ( diff --git a/lib/MetaCPAN/Document/Release.pm b/lib/MetaCPAN/Document/Release.pm index 4e8131248..0912270da 100644 --- a/lib/MetaCPAN/Document/Release.pm +++ b/lib/MetaCPAN/Document/Release.pm @@ -2,7 +2,6 @@ package MetaCPAN::Document::Release; use Moose; -use DateTime qw(); use ElasticSearchX::Model::Document; use MetaCPAN::Types qw( Dependency ); use MetaCPAN::Types::TypeTiny qw( @@ -293,7 +292,7 @@ sub set_first { # currently, the "first" property is not computed on all releases # since this feature has not been around when last reindexed ] - } )->count + } )->count ? 0 : 1; diff --git a/lib/MetaCPAN/Model/Archive.pm b/lib/MetaCPAN/Model/Archive.pm index d65e68d00..60cb001d3 100644 --- a/lib/MetaCPAN/Model/Archive.pm +++ b/lib/MetaCPAN/Model/Archive.pm @@ -5,10 +5,10 @@ use Moose; use MooseX::StrictConstructor; use MetaCPAN::Types::TypeTiny qw( AbsPath ArrayRef Bool Str ); -use Archive::Any; +use Archive::Any (); use Carp qw( croak ); -use Path::Tiny qw( path ); use Digest::file qw( digest_file_hex ); +use Path::Tiny qw( path ); =head1 NAME diff --git a/lib/MetaCPAN/Model/Release.pm b/lib/MetaCPAN/Model/Release.pm index b4b9c1660..c224e6928 100644 --- a/lib/MetaCPAN/Model/Release.pm +++ b/lib/MetaCPAN/Model/Release.pm @@ -15,9 +15,9 @@ use MetaCPAN::Types::TypeTiny qw( AbsPath ArrayRef Str ); use MetaCPAN::Util qw( fix_version); use Module::Metadata 1.000012 (); # Improved package detection. use MooseX::StrictConstructor; -use Path::Tiny qw( path ); -use Parse::PMFile; -use Try::Tiny qw( catch try ); +use Parse::PMFile (); +use Path::Tiny qw( path ); +use Try::Tiny qw( catch try ); with 'MetaCPAN::Role::Logger'; diff --git a/lib/MetaCPAN/Model/User/Account.pm b/lib/MetaCPAN/Model/User/Account.pm index 2f1c40bd9..930ca8eea 100644 --- a/lib/MetaCPAN/Model/User/Account.pm +++ b/lib/MetaCPAN/Model/User/Account.pm @@ -6,9 +6,8 @@ use warnings; use Moose; use ElasticSearchX::Model::Document; -use MetaCPAN::Model::User::Identity (); -use MetaCPAN::Types qw( Identity ); -use MetaCPAN::Types::TypeTiny qw( ArrayRef Bool Dict Str ); +use MetaCPAN::Types qw( Identity ); +use MetaCPAN::Types::TypeTiny qw( ArrayRef Bool Dict Str ); use MetaCPAN::Util; =head1 PROPERTIES diff --git a/lib/MetaCPAN/Pod/Renderer.pm b/lib/MetaCPAN/Pod/Renderer.pm index a3605da9a..fd2953e6f 100644 --- a/lib/MetaCPAN/Pod/Renderer.pm +++ b/lib/MetaCPAN/Pod/Renderer.pm @@ -4,9 +4,9 @@ use MetaCPAN::Moose; use MetaCPAN::Pod::XHTML; use MetaCPAN::Types::TypeTiny qw( Uri ); -use Pod::Markdown; -use Pod::Simple::JustPod (); -use Pod::Text (); +use Pod::Markdown (); +use Pod::Simple::JustPod (); +use Pod::Text (); has perldoc_url_prefix => ( is => 'ro', diff --git a/lib/MetaCPAN/Role/HasConfig.pm b/lib/MetaCPAN/Role/HasConfig.pm index 8cf09202a..a1fe5d4f4 100644 --- a/lib/MetaCPAN/Role/HasConfig.pm +++ b/lib/MetaCPAN/Role/HasConfig.pm @@ -2,11 +2,10 @@ package MetaCPAN::Role::HasConfig; use Moose::Role; -use FindBin (); use Config::ZOMG (); +use FindBin (); use MetaCPAN::Types::TypeTiny qw( HashRef ); use MetaCPAN::Util qw( checkout_root ); -use Module::Runtime qw( require_module ); # Done like this so can be required by a role sub config { diff --git a/lib/MetaCPAN/Role/Logger.pm b/lib/MetaCPAN/Role/Logger.pm index 07e8c2aba..d7181a3e8 100644 --- a/lib/MetaCPAN/Role/Logger.pm +++ b/lib/MetaCPAN/Role/Logger.pm @@ -2,10 +2,10 @@ package MetaCPAN::Role::Logger; use v5.10; use Moose::Role; -use MetaCPAN::Types::TypeTiny qw( Logger Str ); -use Log::Contextual qw( set_logger ); +use Log::Contextual qw( set_logger ); use Log::Log4perl ':easy'; -use Path::Tiny qw( path ); +use MetaCPAN::Types::TypeTiny qw( Logger Str ); +use Path::Tiny qw( path ); has level => ( is => 'ro', diff --git a/lib/MetaCPAN/Role/Script.pm b/lib/MetaCPAN/Role/Script.pm index f7cbb60f8..74832f771 100644 --- a/lib/MetaCPAN/Role/Script.pm +++ b/lib/MetaCPAN/Role/Script.pm @@ -2,15 +2,15 @@ package MetaCPAN::Role::Script; use Moose::Role; -use ElasticSearchX::Model::Document::Types qw(:all); -use MetaCPAN::Util qw( checkout_root ); +use ElasticSearchX::Model::Document::Types qw( ES ); +use File::Path (); +use IO::Prompt::Tiny qw( prompt ); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Model (); use MetaCPAN::Types::TypeTiny qw( Bool HashRef Int Path Str ); +use MetaCPAN::Util qw( checkout_root ); use Mojo::Server (); use Term::ANSIColor qw( colored ); -use IO::Prompt::Tiny qw( prompt ); -use File::Path (); use Carp (); diff --git a/lib/MetaCPAN/Script/Author.pm b/lib/MetaCPAN/Script/Author.pm index 5a093cabe..8d08009bb 100644 --- a/lib/MetaCPAN/Script/Author.pm +++ b/lib/MetaCPAN/Script/Author.pm @@ -6,16 +6,16 @@ use warnings; use Moose; with 'MooseX::Getopt', 'MetaCPAN::Role::Script'; +use Cpanel::JSON::XS qw( decode_json ); use DateTime (); use Email::Valid (); use Encode (); -use Cpanel::JSON::XS qw( decode_json ); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Document::Author (); -use URI (); -use XML::XPath (); use MetaCPAN::Types::TypeTiny qw( Str ); use MetaCPAN::Util qw(diff_struct); +use URI (); +use XML::XPath (); =head1 SYNOPSIS diff --git a/lib/MetaCPAN/Script/Backpan.pm b/lib/MetaCPAN/Script/Backpan.pm index 5de6c4897..d7fd0fd4a 100644 --- a/lib/MetaCPAN/Script/Backpan.pm +++ b/lib/MetaCPAN/Script/Backpan.pm @@ -80,7 +80,7 @@ sub build_release_status_map { ( $self->undo or exists $self->cpan_file_map->{$author}{$archive} - ) + ) ? 'cpan' : 'backpan', $release->{_id} diff --git a/lib/MetaCPAN/Script/Backup.pm b/lib/MetaCPAN/Script/Backup.pm index 806d0bc22..ab3ddd159 100644 --- a/lib/MetaCPAN/Script/Backup.pm +++ b/lib/MetaCPAN/Script/Backup.pm @@ -4,9 +4,9 @@ use strict; use warnings; use feature qw( state ); -use DateTime; -use IO::Zlib (); use Cpanel::JSON::XS qw( decode_json encode_json ); +use DateTime (); +use IO::Zlib (); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Types::TypeTiny qw( Bool Int Path Str ); use Moose; @@ -94,7 +94,7 @@ sub run_restore { my $self = shift; return log_fatal { $self->restore, q{ doesn't exist} } - unless ( -e $self->restore ); + unless ( -e $self->restore ); log_info { 'Restoring from ', $self->restore }; my @bulk; diff --git a/lib/MetaCPAN/Script/CPANTesters.pm b/lib/MetaCPAN/Script/CPANTesters.pm index a1b685953..bdc126616 100644 --- a/lib/MetaCPAN/Script/CPANTesters.pm +++ b/lib/MetaCPAN/Script/CPANTesters.pm @@ -3,11 +3,11 @@ package MetaCPAN::Script::CPANTesters; use Moose; use DBI (); +use ElasticSearchX::Model::Document::Types qw( ESBulk ); use File::stat qw( stat ); use IO::Uncompress::Bunzip2 qw( bunzip2 ); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Types::TypeTiny qw( Bool Path Uri ); -use ElasticSearchX::Model::Document::Types qw( ESBulk ); with 'MetaCPAN::Role::Script', 'MooseX::Getopt::Dashes'; diff --git a/lib/MetaCPAN/Script/CPANTestersAPI.pm b/lib/MetaCPAN/Script/CPANTestersAPI.pm index 61eed003b..c5465d1e2 100644 --- a/lib/MetaCPAN/Script/CPANTestersAPI.pm +++ b/lib/MetaCPAN/Script/CPANTestersAPI.pm @@ -3,10 +3,10 @@ package MetaCPAN::Script::CPANTestersAPI; use strict; use warnings; -use Log::Contextual qw( :log :dlog ); use Cpanel::JSON::XS qw( decode_json ); -use MetaCPAN::Types::TypeTiny qw( Uri ); use ElasticSearchX::Model::Document::Types qw( ESBulk ); +use Log::Contextual qw( :log :dlog ); +use MetaCPAN::Types::TypeTiny qw( Uri ); use Moose; with 'MetaCPAN::Role::Script', 'MooseX::Getopt::Dashes'; diff --git a/lib/MetaCPAN/Script/CVE.pm b/lib/MetaCPAN/Script/CVE.pm index b4318252b..05cabc3bf 100644 --- a/lib/MetaCPAN/Script/CVE.pm +++ b/lib/MetaCPAN/Script/CVE.pm @@ -5,10 +5,10 @@ use namespace::autoclean; use Cpanel::JSON::XS qw( decode_json ); use Log::Contextual qw( :log :dlog ); -use Path::Tiny qw( path ); -use Ref::Util qw( is_arrayref ); use MetaCPAN::Types::TypeTiny qw( Bool Str Uri ); use MetaCPAN::Util qw( numify_version ); +use Path::Tiny qw( path ); +use Ref::Util qw( is_arrayref ); with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; diff --git a/lib/MetaCPAN/Script/First.pm b/lib/MetaCPAN/Script/First.pm index 2ec9475bd..b7f7620cd 100644 --- a/lib/MetaCPAN/Script/First.pm +++ b/lib/MetaCPAN/Script/First.pm @@ -31,7 +31,7 @@ sub run { $release ? log_debug { "@{[ $release->name ]} by @{[ $release->author ]} was first"; - } + } : log_warn { "no release found for distribution @{[$distribution->name]}"; }; diff --git a/lib/MetaCPAN/Script/Latest.pm b/lib/MetaCPAN/Script/Latest.pm index 7bc407ca4..8c9b34c28 100644 --- a/lib/MetaCPAN/Script/Latest.pm +++ b/lib/MetaCPAN/Script/Latest.pm @@ -5,10 +5,10 @@ use warnings; use Log::Contextual qw( :log ); use Moose; -use Parse::CPAN::Packages::Fast; -use CPAN::DistnameInfo; -use DateTime::Format::ISO8601 (); -use MetaCPAN::Types::TypeTiny qw( Bool Str ); +use CPAN::DistnameInfo (); +use DateTime::Format::ISO8601 (); +use MetaCPAN::Types::TypeTiny qw( Bool Str ); +use Parse::CPAN::Packages::Fast (); with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; diff --git a/lib/MetaCPAN/Script/Mapping.pm b/lib/MetaCPAN/Script/Mapping.pm index 690ba156b..c4c1d2a55 100644 --- a/lib/MetaCPAN/Script/Mapping.pm +++ b/lib/MetaCPAN/Script/Mapping.pm @@ -5,21 +5,21 @@ use Moose; use Cpanel::JSON::XS qw( decode_json ); use DateTime (); use Log::Contextual qw( :log ); +use MetaCPAN::Script::Mapping::Contributor (); +use MetaCPAN::Script::Mapping::Cover (); use MetaCPAN::Script::Mapping::CPAN::Author (); use MetaCPAN::Script::Mapping::CPAN::Distribution (); use MetaCPAN::Script::Mapping::CPAN::Favorite (); use MetaCPAN::Script::Mapping::CPAN::File (); use MetaCPAN::Script::Mapping::CPAN::Mirror (); -use MetaCPAN::Script::Mapping::CPAN::Permission (); use MetaCPAN::Script::Mapping::CPAN::Package (); +use MetaCPAN::Script::Mapping::CPAN::Permission (); use MetaCPAN::Script::Mapping::CPAN::Release (); +use MetaCPAN::Script::Mapping::CVE (); use MetaCPAN::Script::Mapping::DeployStatement (); use MetaCPAN::Script::Mapping::User::Account (); use MetaCPAN::Script::Mapping::User::Identity (); use MetaCPAN::Script::Mapping::User::Session (); -use MetaCPAN::Script::Mapping::Contributor (); -use MetaCPAN::Script::Mapping::Cover (); -use MetaCPAN::Script::Mapping::CVE (); use MetaCPAN::Types::TypeTiny qw( Bool Str ); use constant { diff --git a/lib/MetaCPAN/Script/Mirrors.pm b/lib/MetaCPAN/Script/Mirrors.pm index 58abd3174..6a0bcf7cc 100644 --- a/lib/MetaCPAN/Script/Mirrors.pm +++ b/lib/MetaCPAN/Script/Mirrors.pm @@ -3,9 +3,8 @@ package MetaCPAN::Script::Mirrors; use strict; use warnings; -use Cpanel::JSON::XS (); -use Log::Contextual qw( :log :dlog ); -use MetaCPAN::Document::Mirror (); +use Cpanel::JSON::XS (); +use Log::Contextual qw( :log :dlog ); use Moose; with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; diff --git a/lib/MetaCPAN/Script/Package.pm b/lib/MetaCPAN/Script/Package.pm index 04a0c813f..afed7c5e6 100644 --- a/lib/MetaCPAN/Script/Package.pm +++ b/lib/MetaCPAN/Script/Package.pm @@ -2,11 +2,10 @@ package MetaCPAN::Script::Package; use Moose; -use CPAN::DistnameInfo (); -use IO::Uncompress::Gunzip (); -use Log::Contextual qw( :log ); -use MetaCPAN::Document::Package (); -use MetaCPAN::Types::TypeTiny qw( Bool ); +use CPAN::DistnameInfo (); +use IO::Uncompress::Gunzip (); +use Log::Contextual qw( :log ); +use MetaCPAN::Types::TypeTiny qw( Bool ); with 'MooseX::Getopt', 'MetaCPAN::Role::Script'; diff --git a/lib/MetaCPAN/Script/Permission.pm b/lib/MetaCPAN/Script/Permission.pm index be8750f80..90d1e139d 100644 --- a/lib/MetaCPAN/Script/Permission.pm +++ b/lib/MetaCPAN/Script/Permission.pm @@ -2,10 +2,9 @@ package MetaCPAN::Script::Permission; use Moose; -use Log::Contextual qw( :log ); -use MetaCPAN::Document::Permission (); -use MetaCPAN::Types::TypeTiny qw( Bool ); -use PAUSE::Permissions (); +use Log::Contextual qw( :log ); +use MetaCPAN::Types::TypeTiny qw( Bool ); +use PAUSE::Permissions (); with 'MooseX::Getopt', 'MetaCPAN::Role::Script'; diff --git a/lib/MetaCPAN/Script/Release.pm b/lib/MetaCPAN/Script/Release.pm index ebacbc99d..d2cb39c1b 100644 --- a/lib/MetaCPAN/Script/Release.pm +++ b/lib/MetaCPAN/Script/Release.pm @@ -3,19 +3,18 @@ package MetaCPAN::Script::Release; use strict; use warnings; -use CPAN::DistnameInfo (); -use File::Find::Rule (); -use File::stat (); -use List::Util qw( uniq ); -use Log::Contextual qw( :log :dlog ); -use MetaCPAN::Util; +use CPAN::DistnameInfo (); +use File::Find::Rule (); +use File::stat (); +use List::Util qw( uniq ); +use Log::Contextual qw( :log :dlog ); use MetaCPAN::Model::Release (); use MetaCPAN::Script::Runner (); use MetaCPAN::Types::TypeTiny qw( Bool HashRef Int Str ); +use MetaCPAN::Util; use Moose; use PerlIO::gzip; -use Try::Tiny qw( catch try ); -use Path::Tiny qw(path); +use Try::Tiny qw( catch try ); with 'MetaCPAN::Role::Script', 'MooseX::Getopt', 'MetaCPAN::Script::Role::Contributor'; diff --git a/lib/MetaCPAN/Script/Role/External/Cygwin.pm b/lib/MetaCPAN/Script/Role/External/Cygwin.pm index 373903da9..376409d5c 100644 --- a/lib/MetaCPAN/Script/Role/External/Cygwin.pm +++ b/lib/MetaCPAN/Script/Role/External/Cygwin.pm @@ -65,7 +65,7 @@ MIRROR: { log_debug { sprintf "Found %d cygwin-CPAN packages", - scalar keys %{ $ret->{dist} } + scalar keys %{ $ret->{dist} } }; return $ret; diff --git a/lib/MetaCPAN/Script/Runner.pm b/lib/MetaCPAN/Script/Runner.pm index 99dbfba14..8d749a88d 100644 --- a/lib/MetaCPAN/Script/Runner.pm +++ b/lib/MetaCPAN/Script/Runner.pm @@ -5,11 +5,11 @@ use warnings; use Config::ZOMG (); use File::Path (); -use Hash::Merge::Simple qw(merge); +use Hash::Merge::Simple qw( merge ); use Module::Pluggable search_path => ['MetaCPAN::Script']; use Module::Runtime (); -use Try::Tiny qw( catch try ); use Term::ANSIColor qw( colored ); +use Try::Tiny qw( catch try ); our $EXIT_CODE = 0; diff --git a/lib/MetaCPAN/Script/Session.pm b/lib/MetaCPAN/Script/Session.pm index fba3eb70a..28f6f9d9a 100644 --- a/lib/MetaCPAN/Script/Session.pm +++ b/lib/MetaCPAN/Script/Session.pm @@ -3,7 +3,7 @@ package MetaCPAN::Script::Session; use strict; use warnings; -use DateTime; +use DateTime (); use Moose; with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; diff --git a/lib/MetaCPAN/Script/Tickets.pm b/lib/MetaCPAN/Script/Tickets.pm index 81f85961b..bd83f6188 100644 --- a/lib/MetaCPAN/Script/Tickets.pm +++ b/lib/MetaCPAN/Script/Tickets.pm @@ -6,13 +6,12 @@ use namespace::autoclean; # Some issue with rt.cpan.org's cert $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; -use HTTP::Request::Common qw( GET ); -use Log::Contextual qw( :log :dlog ); -use MetaCPAN::Types::TypeTiny (); -use Text::CSV_XS (); -use Net::GitHub::V4 (); -use Ref::Util qw( is_hashref is_ref ); -use URI::Escape qw( uri_escape ); +use HTTP::Request::Common qw( GET ); +use Log::Contextual qw( :log :dlog ); +use Net::GitHub::V4 (); +use Ref::Util qw( is_hashref is_ref ); +use Text::CSV_XS (); +use URI::Escape qw( uri_escape ); with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; @@ -231,7 +230,7 @@ sub parse_tsv { source => $self->rt_dist_url( $row->{dist} ), active => $row->{active}, closed => $row->{inactive}, - map { $_ => $row->{$_} + 0 } + map { $_ => $row->{$_} + 0 } grep { not /^(dist|active|inactive)$/ } keys %$row, }; diff --git a/lib/MetaCPAN/Script/Watcher.pm b/lib/MetaCPAN/Script/Watcher.pm index e23b98438..62fbba9e7 100644 --- a/lib/MetaCPAN/Script/Watcher.pm +++ b/lib/MetaCPAN/Script/Watcher.pm @@ -4,11 +4,11 @@ use strict; use warnings; use Moose; -use CPAN::DistnameInfo; -use Cpanel::JSON::XS qw( decode_json ); -use Log::Contextual qw( :log ); -use MetaCPAN::Util; +use CPAN::DistnameInfo (); +use Cpanel::JSON::XS qw( decode_json ); +use Log::Contextual qw( :log ); use MetaCPAN::Types::TypeTiny qw( Bool ); +use MetaCPAN::Util; with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; diff --git a/lib/MetaCPAN/Server.pm b/lib/MetaCPAN/Server.pm index 498959cc5..383afa49d 100644 --- a/lib/MetaCPAN/Server.pm +++ b/lib/MetaCPAN/Server.pm @@ -4,11 +4,10 @@ use Moose; ## no critic (Modules::RequireEndWithOne) use Catalyst qw( +MetaCPAN::Role::Fastly::Catalyst ), '-Log=warn,error,fatal'; -use Digest::SHA (); -use Log::Log4perl::Catalyst; -use Plack::Builder qw( builder enable ); -use Plack::Middleware::ReverseProxy; -use Ref::Util qw( is_arrayref is_hashref ); +use Digest::SHA (); +use Log::Log4perl::Catalyst (); +use Plack::Builder qw( builder enable ); +use Ref::Util qw( is_arrayref is_hashref ); extends 'Catalyst'; diff --git a/lib/MetaCPAN/Server/Action/Deserialize.pm b/lib/MetaCPAN/Server/Action/Deserialize.pm index b71ef1fa3..f75ff85f5 100644 --- a/lib/MetaCPAN/Server/Action/Deserialize.pm +++ b/lib/MetaCPAN/Server/Action/Deserialize.pm @@ -1,7 +1,6 @@ package MetaCPAN::Server::Action::Deserialize; use Moose; extends 'Catalyst::Action::Deserialize'; -use Cpanel::JSON::XS qw(encode_json); around serialize_bad_request => sub { my $orig = shift; diff --git a/lib/MetaCPAN/Server/Controller.pm b/lib/MetaCPAN/Server/Controller.pm index 24b8ed576..318a7e9f2 100644 --- a/lib/MetaCPAN/Server/Controller.pm +++ b/lib/MetaCPAN/Server/Controller.pm @@ -3,10 +3,7 @@ package MetaCPAN::Server::Controller; use Moose; use namespace::autoclean; -use Cpanel::JSON::XS (); -use Moose::Util (); -use MetaCPAN::Types::TypeTiny qw( HashRef ); -use MetaCPAN::Util qw( single_valued_arrayref_to_scalar ); +use MetaCPAN::Util qw( single_valued_arrayref_to_scalar ); BEGIN { extends 'Catalyst::Controller'; } diff --git a/lib/MetaCPAN/Server/Controller/Diff.pm b/lib/MetaCPAN/Server/Controller/Diff.pm index 4a6c97181..468c3a3b2 100644 --- a/lib/MetaCPAN/Server/Controller/Diff.pm +++ b/lib/MetaCPAN/Server/Controller/Diff.pm @@ -5,8 +5,8 @@ use warnings; use MetaCPAN::Server::Diff (); use Moose; -use Try::Tiny qw( catch try ); use namespace::autoclean; +use Try::Tiny qw( catch try ); BEGIN { extends 'MetaCPAN::Server::Controller' } diff --git a/lib/MetaCPAN/Server/Controller/File.pm b/lib/MetaCPAN/Server/Controller/File.pm index e4c51eac5..c37c11e23 100644 --- a/lib/MetaCPAN/Server/Controller/File.pm +++ b/lib/MetaCPAN/Server/Controller/File.pm @@ -3,7 +3,6 @@ package MetaCPAN::Server::Controller::File; use strict; use warnings; -use ElasticSearchX::Model::Util; use Moose; use MetaCPAN::Util qw( single_valued_arrayref_to_scalar ); diff --git a/lib/MetaCPAN/Server/Controller/Login/GitHub.pm b/lib/MetaCPAN/Server/Controller/Login/GitHub.pm index 68eaa763e..d7b697b10 100644 --- a/lib/MetaCPAN/Server/Controller/Login/GitHub.pm +++ b/lib/MetaCPAN/Server/Controller/Login/GitHub.pm @@ -2,8 +2,8 @@ package MetaCPAN::Server::Controller::Login::GitHub; use Moose; -use HTTP::Request::Common qw( GET POST ); use Cpanel::JSON::XS qw( decode_json ); +use HTTP::Request::Common qw( GET POST ); use LWP::UserAgent (); BEGIN { extends 'MetaCPAN::Server::Controller::Login' } diff --git a/lib/MetaCPAN/Server/Controller/Login/Google.pm b/lib/MetaCPAN/Server/Controller/Login/Google.pm index e49424a2e..f7cd9f498 100644 --- a/lib/MetaCPAN/Server/Controller/Login/Google.pm +++ b/lib/MetaCPAN/Server/Controller/Login/Google.pm @@ -3,8 +3,8 @@ package MetaCPAN::Server::Controller::Login::Google; use strict; use warnings; -use HTTP::Request::Common qw( GET POST ); use Cpanel::JSON::XS qw( decode_json ); +use HTTP::Request::Common qw( GET POST ); use LWP::UserAgent (); use Moose; diff --git a/lib/MetaCPAN/Server/Controller/OAuth2.pm b/lib/MetaCPAN/Server/Controller/OAuth2.pm index f9e592a82..51c9ff2bb 100644 --- a/lib/MetaCPAN/Server/Controller/OAuth2.pm +++ b/lib/MetaCPAN/Server/Controller/OAuth2.pm @@ -3,8 +3,8 @@ package MetaCPAN::Server::Controller::OAuth2; use Moose; BEGIN { extends 'Catalyst::Controller' } -use Digest::SHA (); use Cpanel::JSON::XS qw( decode_json encode_json ); +use Digest::SHA (); use URI (); has login => ( is => 'ro' ); diff --git a/lib/MetaCPAN/Server/Controller/Source.pm b/lib/MetaCPAN/Server/Controller/Source.pm index 6d46fac4c..90ec2e3e3 100644 --- a/lib/MetaCPAN/Server/Controller/Source.pm +++ b/lib/MetaCPAN/Server/Controller/Source.pm @@ -4,8 +4,8 @@ use strict; use warnings; use Moose; -use Plack::App::Directory; -use Plack::MIME; +use Plack::App::Directory (); +use Plack::MIME (); BEGIN { extends 'MetaCPAN::Server::Controller' } diff --git a/lib/MetaCPAN/Server/Controller/User.pm b/lib/MetaCPAN/Server/Controller/User.pm index af97e164f..8a84a76d3 100644 --- a/lib/MetaCPAN/Server/Controller/User.pm +++ b/lib/MetaCPAN/Server/Controller/User.pm @@ -3,9 +3,9 @@ package MetaCPAN::Server::Controller::User; use strict; use warnings; -use DateTime; +use DateTime (); use Moose; -use Log::Log4perl::MDC; +use Log::Log4perl::MDC (); BEGIN { extends 'Catalyst::Controller::REST' } diff --git a/lib/MetaCPAN/Server/Controller/User/Turing.pm b/lib/MetaCPAN/Server/Controller/User/Turing.pm index 7c4e6c13f..539c450ca 100644 --- a/lib/MetaCPAN/Server/Controller/User/Turing.pm +++ b/lib/MetaCPAN/Server/Controller/User/Turing.pm @@ -3,8 +3,7 @@ package MetaCPAN::Server::Controller::User::Turing; use strict; use warnings; -use Captcha::reCAPTCHA; -use DateTime; +use DateTime (); use Moose; BEGIN { extends 'Catalyst::Controller::REST' } diff --git a/lib/MetaCPAN/Server/Diff.pm b/lib/MetaCPAN/Server/Diff.pm index fbf51f8e3..eac4e2f9d 100644 --- a/lib/MetaCPAN/Server/Diff.pm +++ b/lib/MetaCPAN/Server/Diff.pm @@ -5,9 +5,9 @@ use warnings; use Moose; use Encoding::FixLatin (); +use File::Spec (); use IPC::Run3 qw( run3 ); use MetaCPAN::Types::TypeTiny qw( ArrayRef ); -use File::Spec; has git => ( is => 'ro', diff --git a/lib/MetaCPAN/Server/View/JSONP.pm b/lib/MetaCPAN/Server/View/JSONP.pm index 7663b8423..ee9fdf6a9 100644 --- a/lib/MetaCPAN/Server/View/JSONP.pm +++ b/lib/MetaCPAN/Server/View/JSONP.pm @@ -3,8 +3,8 @@ package MetaCPAN::Server::View::JSONP; use strict; use warnings; -use Encode qw( decode_utf8 ); use Cpanel::JSON::XS (); +use Encode qw( decode_utf8 ); use Moose; extends 'Catalyst::View'; diff --git a/lib/MetaCPAN/Types/Internal.pm b/lib/MetaCPAN/Types/Internal.pm index 48caa4aed..7d498d6fe 100644 --- a/lib/MetaCPAN/Types/Internal.pm +++ b/lib/MetaCPAN/Types/Internal.pm @@ -3,7 +3,6 @@ package MetaCPAN::Types::Internal; use strict; use warnings; -use CPAN::Meta; use ElasticSearchX::Model::Document::Types qw( Type ); use MooseX::Getopt::OptionTypeMap (); use MooseX::Types::Moose qw( ArrayRef HashRef ); diff --git a/precious.toml b/precious.toml index f950e2867..54034f059 100644 --- a/precious.toml +++ b/precious.toml @@ -29,6 +29,7 @@ tidy-flags = [ "--backup-and-modify-in-place", "--backup-file-extension=/" ] ok-exit-codes = 0 lint-failure-exit-codes = 2 ignore-stderr = "Begin Error Output Stream" +label = ["perltidy"] [commands.omegasort-gitignore] type = "both" diff --git a/t/01_darkpan.t b/t/01_darkpan.t index 5b5b8de4e..d34ddc85c 100644 --- a/t/01_darkpan.t +++ b/t/01_darkpan.t @@ -4,8 +4,8 @@ use lib 't/lib'; use Devel::Confess; use MetaCPAN::DarkPAN (); -use MetaCPAN::TestServer (); use MetaCPAN::Tests::Controller::Search::DownloadURL (); +use MetaCPAN::TestServer (); use Test::More; use Test::RequiresInternet ( 'cpan.metacpan.org' => 80 ); diff --git a/t/api/controller/cover.t b/t/api/controller/cover.t index 270aee615..f8933777e 100644 --- a/t/api/controller/cover.t +++ b/t/api/controller/cover.t @@ -3,8 +3,8 @@ use Mojo::Base -strict; use lib 't/lib'; use MetaCPAN::TestServer (); +use Test::Mojo (); use Test::More; -use Test::Mojo (); my $server = MetaCPAN::TestServer->new; diff --git a/t/api/controller/search/first.t b/t/api/controller/search/first.t index 3e3d19ab4..603182832 100644 --- a/t/api/controller/search/first.t +++ b/t/api/controller/search/first.t @@ -1,7 +1,7 @@ use Mojo::Base -strict; -use Test::More; use Test::Mojo (); +use Test::More; my $t = Test::Mojo->new('MetaCPAN::API'); diff --git a/t/api/controller/search/web.t b/t/api/controller/search/web.t index feb3e6575..377b7fae0 100644 --- a/t/api/controller/search/web.t +++ b/t/api/controller/search/web.t @@ -1,8 +1,8 @@ use Mojo::Base -strict; -use Test::More; -use Test::Mojo; use Mojo::JSON qw( false true ); +use Test::Mojo; +use Test::More; # Note: we need a release marked as status => latest # so we're using Versions::PkgVar for now diff --git a/t/api/queue.t b/t/api/queue.t index 21bc43132..b70e051e9 100644 --- a/t/api/queue.t +++ b/t/api/queue.t @@ -4,8 +4,8 @@ use lib 't/lib'; use MetaCPAN::DarkPAN (); use Path::Tiny qw( path ); -use Test::More; use Test::Mojo; +use Test::More; my $t = Test::Mojo->new('MetaCPAN::API'); my $app = $t->app; diff --git a/t/document/file.t b/t/document/file.t index 5697e6881..51c822e85 100644 --- a/t/document/file.t +++ b/t/document/file.t @@ -2,6 +2,7 @@ use strict; use warnings; use lib 't/lib'; +use CPAN::Meta (); use MetaCPAN::Document::File (); use Test::More; diff --git a/t/lib/MetaCPAN/TestHelpers.pm b/t/lib/MetaCPAN/TestHelpers.pm index 91baed991..eef6a03ad 100644 --- a/t/lib/MetaCPAN/TestHelpers.pm +++ b/t/lib/MetaCPAN/TestHelpers.pm @@ -8,8 +8,8 @@ use Cpanel::JSON::XS qw( decode_json encode_json ); use File::Copy qw( copy ); use File::pushd qw( pushd ); use FindBin (); -use MetaCPAN::Util qw( checkout_root ); use MetaCPAN::Script::Runner (); +use MetaCPAN::Util qw( checkout_root ); use Path::Tiny qw( path ); use Test::More; use Test::Routine::Util qw( run_tests ); diff --git a/t/lib/MetaCPAN/Tests/Distribution.pm b/t/lib/MetaCPAN/Tests/Distribution.pm index 62a9d329a..19ac50c45 100644 --- a/t/lib/MetaCPAN/Tests/Distribution.pm +++ b/t/lib/MetaCPAN/Tests/Distribution.pm @@ -1,6 +1,6 @@ package MetaCPAN::Tests::Distribution; -use Test::Routine; use Test::More; +use Test::Routine; use version; use MetaCPAN::Types::TypeTiny qw( Str ); diff --git a/t/lib/MetaCPAN/Tests/Extra.pm b/t/lib/MetaCPAN/Tests/Extra.pm index e8c2e0fc6..5863dd13b 100644 --- a/t/lib/MetaCPAN/Tests/Extra.pm +++ b/t/lib/MetaCPAN/Tests/Extra.pm @@ -1,6 +1,6 @@ package MetaCPAN::Tests::Extra; -use Test::Routine; use Test::More; +use Test::Routine; has _extra_tests => ( is => 'ro', diff --git a/t/lib/MetaCPAN/Tests/PSGI.pm b/t/lib/MetaCPAN/Tests/PSGI.pm index 8fa6bdbb1..dc1e254a5 100644 --- a/t/lib/MetaCPAN/Tests/PSGI.pm +++ b/t/lib/MetaCPAN/Tests/PSGI.pm @@ -1,7 +1,7 @@ package MetaCPAN::Tests::PSGI; -use Test::Routine; use Test::More; +use Test::Routine; use MetaCPAN::Server::Test qw( app test_psgi ); diff --git a/t/lib/MetaCPAN/Tests/Release.pm b/t/lib/MetaCPAN/Tests/Release.pm index 96f9dad04..0ba2bdeff 100644 --- a/t/lib/MetaCPAN/Tests/Release.pm +++ b/t/lib/MetaCPAN/Tests/Release.pm @@ -4,10 +4,10 @@ use Test::Routine; use version; -use HTTP::Request::Common qw( GET ); -use List::Util (); -use Test::More; +use HTTP::Request::Common qw( GET ); +use List::Util (); use MetaCPAN::Types::TypeTiny qw( ArrayRef HashRef Str ); +use Test::More; with('MetaCPAN::Tests::Model'); diff --git a/t/lib/MetaCPAN/Tests/UserAgent.pm b/t/lib/MetaCPAN/Tests/UserAgent.pm index d5a0a1cbe..36e0b96e3 100644 --- a/t/lib/MetaCPAN/Tests/UserAgent.pm +++ b/t/lib/MetaCPAN/Tests/UserAgent.pm @@ -3,12 +3,12 @@ use warnings; package MetaCPAN::Tests::UserAgent; -use Test::Routine; use Test::More; +use Test::Routine; -use LWP::UserAgent (); use HTTP::Cookies (); use HTTP::Request (); +use LWP::UserAgent (); has cb => ( is => 'ro', diff --git a/t/lib/Module/Faker/Dist/WithPerl.pm b/t/lib/Module/Faker/Dist/WithPerl.pm index eaecc2e0c..277fe7ffe 100644 --- a/t/lib/Module/Faker/Dist/WithPerl.pm +++ b/t/lib/Module/Faker/Dist/WithPerl.pm @@ -15,8 +15,8 @@ around append_for => sub { utf8::is_utf8( $_->{content} ) ? encode_utf8( $_->{content} ) : $_->{content} - } - grep { $filename eq $_->{file} } @{ $self->append } + } + grep { $filename eq $_->{file} } @{ $self->append } ]; }; diff --git a/t/model/archive.t b/t/model/archive.t index d9d91ab03..9cb2a1f7e 100644 --- a/t/model/archive.t +++ b/t/model/archive.t @@ -4,9 +4,9 @@ use lib 't/lib'; use Digest::SHA qw( sha1_hex ); use MetaCPAN::TestHelpers qw( fakecpan_dir ); +use Test::Deep qw( cmp_bag ); +use Test::Fatal qw( exception ); use Test::More; -use Test::Fatal qw( exception ); -use Test::Deep qw( cmp_bag ); my $CLASS = 'MetaCPAN::Model::Archive'; require_ok $CLASS; diff --git a/t/model/release/dependencies.t b/t/model/release/dependencies.t index d08dd8a6f..7ca0383cc 100644 --- a/t/model/release/dependencies.t +++ b/t/model/release/dependencies.t @@ -4,8 +4,8 @@ use lib 't/lib'; use MetaCPAN::Model::Release (); use MetaCPAN::TestHelpers qw( fakecpan_dir get_config ); +use Test::Deep qw( cmp_bag ); use Test::More; -use Test::Deep qw( cmp_bag ); my $config = get_config(); diff --git a/t/model/search.t b/t/model/search.t index b558166b7..5ce0290a9 100644 --- a/t/model/search.t +++ b/t/model/search.t @@ -2,11 +2,11 @@ use strict; use warnings; use lib 't/lib'; +use Cpanel::JSON::XS (); use MetaCPAN::Model::Search (); use MetaCPAN::TestServer (); +use Test::Deep qw( cmp_deeply ignore ); use Test::More; -use Test::Deep qw( cmp_deeply ignore ); -use Cpanel::JSON::XS (); # Just use this to get an es object. my $server = MetaCPAN::TestServer->new; diff --git a/t/package.t b/t/package.t index 07e9536ce..819b5e7b8 100644 --- a/t/package.t +++ b/t/package.t @@ -2,8 +2,8 @@ use strict; use warnings; use lib 't/lib'; -use Test::More; use MetaCPAN::Script::Runner (); +use Test::More; local @ARGV = ('package'); diff --git a/t/permission.t b/t/permission.t index 350de1211..403703209 100644 --- a/t/permission.t +++ b/t/permission.t @@ -2,8 +2,8 @@ use strict; use warnings; use lib 't/lib'; -use Test::More; use MetaCPAN::Script::Runner (); +use Test::More; local @ARGV = ('permission'); diff --git a/t/script/cover.t b/t/script/cover.t index 09ba5fc6a..d31d0a0a6 100644 --- a/t/script/cover.t +++ b/t/script/cover.t @@ -2,9 +2,9 @@ use strict; use warnings; use lib 't/lib'; -use MetaCPAN::Util qw( checkout_root ); use MetaCPAN::Script::Cover (); use MetaCPAN::Script::Runner (); +use MetaCPAN::Util qw( checkout_root ); use Test::More; use URI (); diff --git a/t/script/load.t b/t/script/load.t index 6d43d8c3e..65754fca4 100644 --- a/t/script/load.t +++ b/t/script/load.t @@ -8,17 +8,19 @@ use Test::More; use MetaCPAN::Script::Author (); use MetaCPAN::Script::Backpan (); use MetaCPAN::Script::Backup (); -use MetaCPAN::Script::CPANTesters (); -use MetaCPAN::Script::CPANTestersAPI (); use MetaCPAN::Script::Check (); use MetaCPAN::Script::Checksum (); use MetaCPAN::Script::Contributor (); use MetaCPAN::Script::Cover (); +use MetaCPAN::Script::CPANTesters (); +use MetaCPAN::Script::CPANTestersAPI (); use MetaCPAN::Script::External (); use MetaCPAN::Script::Favorite (); use MetaCPAN::Script::First (); use MetaCPAN::Script::Latest (); use MetaCPAN::Script::Mapping (); +use MetaCPAN::Script::Mapping::Contributor (); +use MetaCPAN::Script::Mapping::Cover (); use MetaCPAN::Script::Mapping::CPAN::Author (); use MetaCPAN::Script::Mapping::CPAN::Distribution (); use MetaCPAN::Script::Mapping::CPAN::Favorite (); @@ -27,8 +29,6 @@ use MetaCPAN::Script::Mapping::CPAN::Mirror (); use MetaCPAN::Script::Mapping::CPAN::Package (); use MetaCPAN::Script::Mapping::CPAN::Permission (); use MetaCPAN::Script::Mapping::CPAN::Release (); -use MetaCPAN::Script::Mapping::Contributor (); -use MetaCPAN::Script::Mapping::Cover (); use MetaCPAN::Script::Mapping::DeployStatement (); use MetaCPAN::Script::Mapping::User::Account (); use MetaCPAN::Script::Mapping::User::Identity (); diff --git a/t/script/mapping.t b/t/script/mapping.t index 1beb52c94..37c13a965 100644 --- a/t/script/mapping.t +++ b/t/script/mapping.t @@ -4,8 +4,8 @@ use lib 't/lib'; use Test::More; -use MetaCPAN::Script::Runner (); use MetaCPAN::Script::Mapping (); +use MetaCPAN::Script::Runner (); my $config = MetaCPAN::Script::Runner::build_config; diff --git a/t/script/queue.t b/t/script/queue.t index 81161a54f..18df3aa47 100644 --- a/t/script/queue.t +++ b/t/script/queue.t @@ -4,8 +4,8 @@ use lib 't/lib'; use Test::More; -use MetaCPAN::Script::Runner (); use MetaCPAN::Script::Queue (); +use MetaCPAN::Script::Runner (); my $config = MetaCPAN::Script::Runner::build_config; local @ARGV = ( '--dir', $config->{cpan} ); diff --git a/t/script/river.t b/t/script/river.t index b425b523d..13b8ec014 100644 --- a/t/script/river.t +++ b/t/script/river.t @@ -2,11 +2,11 @@ use strict; use warnings; use lib 't/lib'; -use MetaCPAN::Util qw( checkout_root ); use MetaCPAN::Script::River (); use MetaCPAN::Script::Runner (); use MetaCPAN::Server::Test qw( app GET ); use MetaCPAN::TestHelpers qw( decode_json_ok ); +use MetaCPAN::Util qw( checkout_root ); use Test::More; use URI (); diff --git a/t/server/controller/bad_request.t b/t/server/controller/bad_request.t index d785731f1..a3890834f 100644 --- a/t/server/controller/bad_request.t +++ b/t/server/controller/bad_request.t @@ -5,8 +5,8 @@ use lib 't/lib'; use Cpanel::JSON::XS qw( decode_json ); use MetaCPAN::Server (); use Plack::Test (); +use Ref::Util qw( is_hashref ); use Test::More; -use Ref::Util qw( is_hashref ); my $app = MetaCPAN::Server->new->to_app(); my $test = Plack::Test->create($app); diff --git a/t/server/controller/changes.t b/t/server/controller/changes.t index a0a82d6fc..f383ad5c1 100644 --- a/t/server/controller/changes.t +++ b/t/server/controller/changes.t @@ -128,7 +128,7 @@ done_testing; sub get_ok { my ( $cb, $path, $code ) = @_; - ok( my $res = $cb->( GET $path), "GET $path" ); + ok( my $res = $cb->( GET $path ), "GET $path" ); is( $res->code, $code, "code $code" ); is( $res->header('content-type'), diff --git a/t/server/controller/distribution.t b/t/server/controller/distribution.t index 2c8c300b2..c4af70c69 100644 --- a/t/server/controller/distribution.t +++ b/t/server/controller/distribution.t @@ -40,7 +40,7 @@ test_psgi app, sub { my $cb = shift; for my $test (@tests) { my ( $k, $v ) = @{$test}; - ok( my $res = $cb->( GET $k), "GET $k" ); + ok( my $res = $cb->( GET $k ), "GET $k" ); # TRAVIS 5.18 is( $res->code, $v->{code}, "code " . $v->{code} ); diff --git a/t/server/controller/download_url.t b/t/server/controller/download_url.t index d79710f22..2157a0b69 100644 --- a/t/server/controller/download_url.t +++ b/t/server/controller/download_url.t @@ -7,8 +7,8 @@ use HTTP::Request::Common qw( GET ); use MetaCPAN::Server (); use MetaCPAN::TestHelpers qw( test_cache_headers ); use Plack::Test (); +use Ref::Util qw( is_hashref ); use Test::More; -use Ref::Util qw( is_hashref ); my $app = MetaCPAN::Server->new->to_app(); my $test = Plack::Test->create($app); diff --git a/t/server/controller/file.t b/t/server/controller/file.t index 115ccffcb..d5d33062c 100644 --- a/t/server/controller/file.t +++ b/t/server/controller/file.t @@ -47,7 +47,7 @@ my %tests = ( test_psgi app, sub { my $cb = shift; while ( my ( $k, $v ) = each %tests ) { - ok( my $res = $cb->( GET $k), "GET $k" ); + ok( my $res = $cb->( GET $k ), "GET $k" ); is( $res->code, $v->{code}, "code " . $v->{code} ); is( $res->header('content-type'), diff --git a/t/server/controller/mirror.t b/t/server/controller/mirror.t index 39c33b6e1..76e8e00e8 100644 --- a/t/server/controller/mirror.t +++ b/t/server/controller/mirror.t @@ -34,7 +34,7 @@ test_psgi app, sub { my $cb = shift; for my $k ( sort keys %tests ) { my $v = $tests{$k}; - ok( my $res = $cb->( GET $k), "GET $k" ); + ok( my $res = $cb->( GET $k ), "GET $k" ); is( $res->code, $v->{code}, "code " . $v->{code} ); is( $res->header('content-type'), diff --git a/t/server/controller/module.t b/t/server/controller/module.t index 5f8b83c43..3db2505b0 100644 --- a/t/server/controller/module.t +++ b/t/server/controller/module.t @@ -57,7 +57,7 @@ my %tests = ( test_psgi app, sub { my $cb = shift; while ( my ( $k, $v ) = each %tests ) { - ok( my $res = $cb->( GET $k), "GET $k" ); + ok( my $res = $cb->( GET $k ), "GET $k" ); is( $res->code, $v->{code}, "code " . $v->{code} ); is( $res->header('content-type'), diff --git a/t/server/controller/pod.t b/t/server/controller/pod.t index b3eed4a5f..308327b9e 100644 --- a/t/server/controller/pod.t +++ b/t/server/controller/pod.t @@ -63,7 +63,7 @@ my $app = MetaCPAN::Server->new->to_app(); my $test = Plack::Test->create($app); while ( my ( $k, $v ) = each %tests ) { - my $res = $test->request( GET $k); + my $res = $test->request( GET $k ); ok( $res, "GET $k" ); is( $res->code, $v->{code}, "code " . $v->{code} ); is( @@ -144,7 +144,7 @@ while ( my ( $k, $v ) = each %tests ) { { my $path = '/pod/BadPod?show_errors=1'; - my $res = $test->request( GET $path); + my $res = $test->request( GET $path ); ok( $res, "GET $path" ); is( $res->code, 200, 'code 200' ); like( diff --git a/t/server/controller/source.t b/t/server/controller/source.t index d14ffb875..05453de86 100644 --- a/t/server/controller/source.t +++ b/t/server/controller/source.t @@ -62,7 +62,7 @@ my %tests = ( test_psgi app, sub { my $cb = shift; while ( my ( $k, $v ) = each %tests ) { - ok( my $res = $cb->( GET $k), "GET $k" ); + ok( my $res = $cb->( GET $k ), "GET $k" ); is( $res->code, $v->{code}, "code " . $v->{code} ); test_cache_headers( $res, $v ); diff --git a/t/server/controller/url_parameters.pm b/t/server/controller/url_parameters.pm index 5472cc24c..58639a356 100644 --- a/t/server/controller/url_parameters.pm +++ b/t/server/controller/url_parameters.pm @@ -6,8 +6,8 @@ use HTTP::Request::Common qw( GET ); use MetaCPAN::Server (); use MetaCPAN::TestHelpers qw( test_cache_headers ); use Plack::Test (); +use Ref::Util qw( is_arrayref is_hashref ); use Test::More; -use Ref::Util qw( is_arrayref is_hashref ); my $app = MetaCPAN::Server->new->to_app(); my $test = Plack::Test->create($app); diff --git a/t/server/not_found.t b/t/server/not_found.t index cf9baa049..ee2666d28 100644 --- a/t/server/not_found.t +++ b/t/server/not_found.t @@ -22,7 +22,7 @@ test_psgi app, sub { for my $test (@tests) { my ( $path, $code ) = @{$test}; - ok( my $res = $cb->( GET $path), "GET $path" ); + ok( my $res = $cb->( GET $path ), "GET $path" ); is( $res->code, $code, "code $code" ); # 404 should still be json diff --git a/t/util.t b/t/util.t index bf07626de..777a02de8 100644 --- a/t/util.t +++ b/t/util.t @@ -10,8 +10,8 @@ use MetaCPAN::Util qw( strip_pod ); -use Test::More; use Test::Fatal qw( exception ); +use Test::More; ok( generate_sid(), 'generate_sid' ); diff --git a/test-data/fakecpan/configs/binary-data.pl b/test-data/fakecpan/configs/binary-data.pl index 8b5e26917..975349a31 100644 --- a/test-data/fakecpan/configs/binary-data.pl +++ b/test-data/fakecpan/configs/binary-data.pl @@ -1,27 +1,28 @@ ## no critic { - name => 'Binary-Data', - abstract => 'Binary after __DATA__ token', - version => '0.01', + name => 'Binary-Data', + abstract => 'Binary after __DATA__ token', + version => '0.01', - # Specify provides so that both modules are included - # in release 'provides' list and the release will get marked as latest. - provides => { - 'Binary::Data' => { - file => 'lib/Binary/Data.pm', - version => '0.01' + # Specify provides so that both modules are included + # in release 'provides' list and the release will get marked as latest. + provides => { + 'Binary::Data' => { + file => 'lib/Binary/Data.pm', + version => '0.01' + }, + 'Binary::Data::WithPod' => { + file => 'lib/Binary/Data/WithPod.pm', + version => '0.02' + } }, - 'Binary::Data::WithPod' => { - file => 'lib/Binary/Data/WithPod.pm', - version => '0.02' - } - }, - X_Module_Faker => { - cpan_author => 'BORISNAT', - append => [ { - file => 'lib/Binary/Data.pm', - content => < { + cpan_author => 'BORISNAT', + append => [ + { + file => 'lib/Binary/Data.pm', + content => < 'lib/Binary/Data/WithPod.pm', - 'content' => < 'lib/Binary/Data/WithPod.pm', + 'content' => < "Encoding", +{ + "name" => "Encoding", "abstract" => "Beyond 7bit ascii", "version" => "1.0", "X_Module_Faker" => { "cpan_author" => "RWSTAUNER", "omitted_files" => [ "META.json", "META.yml" ], "append" => [ - { "file" => "lib/Encoding/CP1252.pm", + { + "file" => "lib/Encoding/CP1252.pm", "content" => "package Encoding::CP1252;\n\nsub bullet { qq<\x{95}> }\n", }, diff --git a/test-data/fakecpan/configs/encoding-1.1.pl b/test-data/fakecpan/configs/encoding-1.1.pl index c92b3ebe3..aa16f0818 100644 --- a/test-data/fakecpan/configs/encoding-1.1.pl +++ b/test-data/fakecpan/configs/encoding-1.1.pl @@ -1,15 +1,18 @@ -{ "name" => "Encoding", +{ + "name" => "Encoding", "abstract" => "Beyond 7bit ascii", "version" => "1.1", "X_Module_Faker" => { "cpan_author" => "RWSTAUNER", "omitted_files" => [ "META.json", "META.yml" ], "append" => [ - { "file" => "lib/Encoding/UTF8.pm", + { + "file" => "lib/Encoding/UTF8.pm", "content" => "package Encoding::UTF8;\n\nuse utf8;\nmy \$heart = qq<\342\235\244>;\n", }, - { "file" => "lib/Encoding/CP1252.pm", + { + "file" => "lib/Encoding/CP1252.pm", "content" => "package Encoding::CP1252;\n\nsub bullet { qq<\x95-\xf7> }\n", }, diff --git a/test-data/fakecpan/configs/encoding-1.2.pl b/test-data/fakecpan/configs/encoding-1.2.pl index 21bd017ed..a16f2fb97 100644 --- a/test-data/fakecpan/configs/encoding-1.2.pl +++ b/test-data/fakecpan/configs/encoding-1.2.pl @@ -1,11 +1,13 @@ -{ "name" => "Encoding", +{ + "name" => "Encoding", "abstract" => "Beyond 7bit ascii", "version" => "1.2", "X_Module_Faker" => { "cpan_author" => "RWSTAUNER", "omitted_files" => [ "META.json", "META.yml" ], "append" => [ - { "file" => "lib/Encoding/UTF8.pm", + { + "file" => "lib/Encoding/UTF8.pm", "content" => "package Encoding::UTF8;\n\nuse utf8;\nmy \$heart = qq<\342\231\245>;\n", }, diff --git a/test-data/fakecpan/configs/file-duplicates.pl b/test-data/fakecpan/configs/file-duplicates.pl index 72de45acb..e5c1654f1 100644 --- a/test-data/fakecpan/configs/file-duplicates.pl +++ b/test-data/fakecpan/configs/file-duplicates.pl @@ -31,8 +31,8 @@ }; my $meta = { - name => 'File-Duplicates', - author => 'BORISNAT', + name => 'File-Duplicates', + author => 'BORISNAT', abstract => 'A dist with duplicate file names in different directories', version => '1.000', @@ -48,10 +48,10 @@ 'url' => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec' }, - # Pass some packages so that Module::Faker will add them to 02packages - # and this dist will get 'status' => 'latest' - # but omit the Dupe packages since the paths are explicitly not correct - # and we don't want Module::Faker to generate the missing ones for us. + # Pass some packages so that Module::Faker will add them to 02packages + # and this dist will get 'status' => 'latest' + # but omit the Dupe packages since the paths are explicitly not correct + # and we don't want Module::Faker to generate the missing ones for us. provides => { map { ( $_ => $provides->{$_} ) } grep {/File/} keys %$provides }, @@ -62,7 +62,7 @@ cpan_author => $meta->{author}, append => [ { - file => 'META.json', + file => 'META.json', content => JSON::encode_json( { %$meta, provides => $provides } ), }, @@ -87,7 +87,7 @@ content => 'short path but no_index', }, { - file => 'lib/Dupe.pm', + file => 'lib/Dupe.pm', content => 'shortest indexed path though metadata is probably wrong', }, diff --git a/xt/search_web.t b/xt/search_web.t index 9d5043deb..6145b1f92 100644 --- a/xt/search_web.t +++ b/xt/search_web.t @@ -5,7 +5,6 @@ use lib 't/lib'; # USE `bin/prove_live` to run this # READ the README.txt in this dir -use Data::Dumper; use MetaCPAN::Model::Search (); use MetaCPAN::TestServer (); use Test::More; @@ -32,13 +31,15 @@ my %tests = ( 'Perl::Critic' => 'Perl::Critic', ); -for my $q (sort keys %tests) { - my $match = $tests{$q}; - my $returned = $search->search_web($q); +for my $q ( sort keys %tests ) { + my $match = $tests{$q}; + my $returned = $search->search_web($q); my $first_match = $returned->{results}->[0]->[0]; - is($first_match->{documentation}, $match, "Search for ${q} matched ${match}"); -# or diag Dumper($first_match); + is( $first_match->{documentation}, + $match, "Search for ${q} matched ${match}" ); + + # or diag Dumper($first_match); } done_testing();