Use perlcritic
[gruntmaster-data.git] / lib / Gruntmaster / Data.pm
index b27444335bbc301b7cdd004031e146db0ecad686..694fc8e688eba12567f33bbe449b07888cf22a56 100644 (file)
@@ -29,14 +29,14 @@ use constant JOBS_PER_PAGE => 10;
 
 sub dynsub{
        our ($name, $sub) = @_;
-       no strict 'refs';
+       no strict 'refs'; ## no critic (Strict)
        *$name = subname $name => $sub
 }
 
 BEGIN {
        for my $rs (qw/contest contest_problem job open problem user/) {
                my $rsname = ucfirst $rs;
-               $rsname =~ s/_([a-z])/\u$1/g;
+               $rsname =~ s/_([a-z])/\u$1/gs;
                dynsub PL_N($rs) => sub { $_[0]->resultset($rsname)              };
                dynsub      $rs  => sub { $_[0]->resultset($rsname)->find($_[1]) };
        }
@@ -66,15 +66,15 @@ sub standings {
                        next if $time < 0;
                        my $value = $job->problem->value;
                        my $factor = $job->result ? 0 : 1;
-                       $factor = $1 / 100 if $job->result_text =~ /^(\d+ )/;
+                       $factor = $1 / 100 if $job->result_text =~ /^(\d+ )/s;
                        $scores{$job->owner->id}{$job->problem->id} = int ($factor * calc_score ($value, $time, $tries{$job->owner->id}{$job->problem->id}++, $ct->stop - $ct->start));
                } else {
-                       no warnings 'numeric';
+                       no warnings 'numeric'; ## no critic (ProhibitNoWarnings)
                        $scores{$job->owner->id}{$job->problem->id} = 0 + $job->result_text || ($job->result ? 0 : 100)
                }
        }
 
-       my @st = sort { $b->{score} <=> $a->{score} or $a->{user}->id cmp $b->{user}->id} map {
+       my @st = sort { $b->{score} <=> $a->{score} or $a->{user}->id cmp $b->{user}->id} map { ## no critic (ProhibitReverseSortBlock)
                my $user = $_;
                +{
                        user => $self->user($user),
@@ -91,7 +91,7 @@ sub standings {
 
 sub user_list {
        my $rs = $_[0]->users->search(undef, {order_by => 'name', columns => USER_PUBLIC_COLUMNS});
-       [ map +{ $_->get_columns }, $rs->all ]
+       [ map { { $_->get_columns } } $rs->all ]
 }
 
 sub user_entry {
@@ -118,7 +118,7 @@ sub problem_entry {
        my ($self, $id, $contest, $user) = @_;
        my $pb = $self->problems->find($id, {columns => PROBLEM_PUBLIC_COLUMNS, prefetch => 'owner'});
        my $running = $contest && $self->contest($contest)->is_running;
-       eval {
+       eval { ## no critic (RequireCheckingReturnValueOfEval)
                $self->opens->create({
                        contest => $contest,
                        problem => $id,
This page took 0.011048 seconds and 4 git commands to generate.