diff --git a/lib/Pear/LocalLoop/Controller/Admin/Import.pm b/lib/Pear/LocalLoop/Controller/Admin/Import.pm index 4ef8f34..43a8945 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Import.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Import.pm @@ -71,6 +71,7 @@ sub post_add { } ); + ## no critic (InputOutput::RequireBriefOpen) open my $fh, '<', \$csv_data; # List context returns the actual headers @@ -99,6 +100,9 @@ sub post_add { } my $csv_output = $csv->getline_hr_all($fh); + + close $fh; + ## use critic unless ( scalar(@$csv_output) ) { $c->_csv_flash_error("No data found"); diff --git a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm index 5b05a42..620949f 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm @@ -123,7 +123,7 @@ sub valid_read { } sub valid_edit { - my $c = shift; + my ($c, $warning) = @_; my $validation = $c->validation; $validation->required('name'); @@ -180,9 +180,9 @@ sub valid_edit { ); } finally { - if (@_) { + if ($warning) { use Devel::Dwarn; - Dwarn \@_; + Dwarn \$warning; $c->flash( error => 'Something went wrong Updating the Organisation' ); } diff --git a/lib/Pear/LocalLoop/Controller/Admin/Users.pm b/lib/Pear/LocalLoop/Controller/Admin/Users.pm index edd76b4..292a0f9 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Users.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Users.pm @@ -70,7 +70,7 @@ sub read { ## no critic (Subroutines::ProhibitBuiltinHomonyms) sub update { ## use critic - my $c = shift; + my ($c, $error) = @_; my $id = $c->param('id'); @@ -145,9 +145,9 @@ sub update { ); } finally { - if (@_) { + if ($error) { $c->flash( error => 'Something went wrong Updating the User' ); - $c->app->log->warn( Dumper @_ ); + $c->app->log->warn( Dumper $error ); } else { $c->flash( success => 'Updated User' ); @@ -188,9 +188,9 @@ sub update { ); } finally { - if (@_) { + if ($error) { $c->flash( error => 'Something went wrong Updating the User' ); - $c->app->log->warn( Dumper @_ ); + $c->app->log->warn( Dumper $error ); } else { $c->flash( success => 'Updated User' ); diff --git a/lib/Pear/LocalLoop/Controller/Api/Stats.pm b/lib/Pear/LocalLoop/Controller/Api/Stats.pm index 25278fb..2e8bef1 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Stats.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Stats.pm @@ -460,14 +460,16 @@ sub post_leaderboards { my @leaderboard_array = $today_values->all; if ( $validation->param('type') =~ /total$/ ) { + ## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements) @leaderboard_array = ( map { { %$_, - value => $_->{value} / 100000, + value => $_->{value} / 100000 } } @leaderboard_array ); + ## use critic } my $current_user_position = @@ -543,6 +545,7 @@ sub post_leaderboards_paged { $values_count = $today_values->pager->total_entries; if ( $validation->param('type') =~ /total$/ ) { + ## no critic (ValuesAndExpressions::ProhibitCommaSeparatedStatements) @leaderboard_array = ( map { { @@ -551,6 +554,7 @@ sub post_leaderboards_paged { } } @leaderboard_array ); + ## use critic } $current_user_position = $today_values->find( diff --git a/lib/Pear/LocalLoop/Schema/Result/EntityAssociation.pm b/lib/Pear/LocalLoop/Schema/Result/EntityAssociation.pm index 287a8b9..4de3d20 100644 --- a/lib/Pear/LocalLoop/Schema/Result/EntityAssociation.pm +++ b/lib/Pear/LocalLoop/Schema/Result/EntityAssociation.pm @@ -34,3 +34,5 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to( "entity", "Pear::LocalLoop::Schema::Result::Entity", "entity_id", ); + +1; diff --git a/lib/Pear/LocalLoop/Schema/ResultSet/Entity.pm b/lib/Pear/LocalLoop/Schema/ResultSet/Entity.pm index eb89608..392046e 100644 --- a/lib/Pear/LocalLoop/Schema/ResultSet/Entity.pm +++ b/lib/Pear/LocalLoop/Schema/ResultSet/Entity.pm @@ -5,7 +5,9 @@ use warnings; use base 'DBIx::Class::ResultSet'; +## no critic (Subroutines::RequireArgUnpacking) sub sales { return shift->search_related( 'sales', @_ ) } +## use critic sub create_org { my ( $self, $org ) = @_; @@ -16,8 +18,6 @@ sub create_org { type => 'organisation', } ); - - return 1; } 1; diff --git a/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm b/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm index b7964e5..186425e 100644 --- a/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm +++ b/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm @@ -39,9 +39,9 @@ sub _unordered_get_values { } sub get_users { - my $self = shift; + my ($self, $set_id) = @_; - return $self->_unordered_get_values(@_)->search( + return $self->_unordered_get_values($set_id)->search( {}, { group_by => 'user_name', @@ -51,9 +51,9 @@ sub get_users { } sub get_orgs { - my $self = shift; + my ( $self, $set_id ) = shift; - return $self->_unordered_get_values(@_)->search( + return $self->_unordered_get_values($set_id)->search( {}, { group_by => 'org_name', diff --git a/lib/Pear/LocalLoop/Schema/ResultSet/Organisation.pm b/lib/Pear/LocalLoop/Schema/ResultSet/Organisation.pm index afa028f..a8ef125 100644 --- a/lib/Pear/LocalLoop/Schema/ResultSet/Organisation.pm +++ b/lib/Pear/LocalLoop/Schema/ResultSet/Organisation.pm @@ -5,6 +5,8 @@ use warnings; use base 'DBIx::Class::ResultSet'; +## no critic (Subroutines::RequireArgUnpacking) sub entity { return shift->search_related( 'entity', @_ ) } +## use critic 1; diff --git a/lib/Test/Pear/LocalLoop.pm b/lib/Test/Pear/LocalLoop.pm index 2de5f80..5119cfb 100644 --- a/lib/Test/Pear/LocalLoop.pm +++ b/lib/Test/Pear/LocalLoop.pm @@ -69,7 +69,7 @@ has mojo => ( builder => sub { my $self = shift; - $ENV{MOJO_CONFIG} = $self->config->filename; + local $ENV{MOJO_CONFIG} = $self->config->filename; my $t = Test::Mojo->new('Pear::LocalLoop'); $t->app->schema->deploy; @@ -197,8 +197,6 @@ sub gen_upload { json => Mojo::JSON::encode_json($args), file => $file, }; - - return 1; } sub install_fixtures {