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]) };
}
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),
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 {
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,
--- /dev/null
+severity = 1
+
+[-BuiltinFunctions::ProhibitComplexMappings]
+[-CodeLayout::RequireTidyCode]
+[-ControlStructures::ProhibitPostfixControls]
+[-ControlStructures::ProhibitUnlessBlocks]
+[-Documentation::PodSpelling]
+[-Documentation::RequirePodLinksIncludeText]
+[-InputOutput::RequireBracedFileHandleWithPrint]
+[-Modules::RequireExplicitPackage]
+[-References::ProhibitDoubleSigils]
+[-RegularExpressions::ProhibitEnumeratedClasses]
+[-RegularExpressions::RequireLineBoundaryMatching]
+[-Subroutines::RequireFinalReturn]
+[-ValuesAndExpressions::ProhibitConstantPragma]
+[-ValuesAndExpressions::ProhibitEmptyQuotes]
+[-ValuesAndExpressions::ProhibitMagicNumbers]
+[-ValuesAndExpressions::ProhibitNoisyQuotes]
+[-Variables::ProhibitLocalVars]
+[-Variables::ProhibitPackageVars]
+[-Variables::ProhibitPunctuationVars]
+
+[RegularExpressions::RequireExtendedFormatting]
+minimum_regex_length_to_complain_about = 20
+
+[Documentation::RequirePodSections]
+lib_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE
+script_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE
+
+[Subroutines::RequireArgUnpacking]
+short_subroutine_statements = 5
+allow_subscripts = 1