From: Marius Gavrilescu Date: Fri, 2 Oct 2015 18:55:30 +0000 (+0300) Subject: Make perlcritic happy X-Git-Tag: 5999.000_014~3 X-Git-Url: http://git.ieval.ro/?p=gruntmaster-data.git;a=commitdiff_plain;h=dcf7f640534d6ad6d0273ac5b8bb1e9892fcaa56 Make perlcritic happy --- diff --git a/lib/Gruntmaster/App/Command.pm b/lib/Gruntmaster/App/Command.pm index b1be168..94695ac 100644 --- a/lib/Gruntmaster/App/Command.pm +++ b/lib/Gruntmaster/App/Command.pm @@ -3,6 +3,7 @@ package Gruntmaster::App::Command; use 5.014000; use strict; use warnings; +use re '/s'; our $VERSION = '5999.000_004'; @@ -13,9 +14,9 @@ sub description { my ($self) = @_; my ($file) = (ref $self) =~ s,::,/,gr; my $usage; - open my $fh, '>', \$usage; + open my $fh, '>', \$usage; ## no critic (RequireCheckedOpen) pod2usage(-input => $INC{"$file.pm"}, -output => $fh, -exitval => 'NOEXIT', -verbose => 99, -sections => [qw/SYNOPSIS DESCRIPTION/]); - close $fh; + close $fh; ## no critic (RequireCheckedClose) $usage =~ s/Usage:/Usage examples:/; 1 while chomp $usage; $usage diff --git a/lib/Gruntmaster/App/Command/Add.pm b/lib/Gruntmaster/App/Command/Add.pm index 5e8b07a..b0df358 100644 --- a/lib/Gruntmaster/App/Command/Add.pm +++ b/lib/Gruntmaster/App/Command/Add.pm @@ -48,8 +48,8 @@ sub add_contest { my $name = prompt 'Contest name'; my $owner = prompt 'Owner'; - my $start = str2time prompt 'Start time' or die 'Cannot parse time'; - my $stop = str2time prompt 'Stop time' or die 'Cannot parse time'; + my $start = str2time prompt 'Start time' or die "Cannot parse time\n"; + my $stop = str2time prompt 'Stop time' or die "Cannot parse time\n"; db->insert(contests => {id => $id, name => $name, owner => $owner, start => $start, stop => $stop}); } diff --git a/lib/Gruntmaster/App/Command/Set.pm b/lib/Gruntmaster/App/Command/Set.pm index 3ae62b0..406d013 100644 --- a/lib/Gruntmaster/App/Command/Set.pm +++ b/lib/Gruntmaster/App/Command/Set.pm @@ -11,7 +11,7 @@ use Gruntmaster::Data; use File::Slurp qw/read_file/; sub opt_spec { - ['file!', 'Use the contents of a file as value'], + ['file!', 'Use the contents of a file as value'] } sub usage_desc { "%c [-cjpu] set id column value [column value ...]\n%c [-cjpu] set --file id column filename [column filename ...]" } diff --git a/lib/Gruntmaster/App/Command/Show.pm b/lib/Gruntmaster/App/Command/Show.pm index fbdac50..e21578a 100644 --- a/lib/Gruntmaster/App/Command/Show.pm +++ b/lib/Gruntmaster/App/Command/Show.pm @@ -35,7 +35,7 @@ sub show_contest { my (%columns) = @_; $columns{$_} = strftime '%c', localtime $columns{$_} for qw/start stop/; - print < Phone: $columns{phone} Since: $columns{since} diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 3fed5b3..98e62d6 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -4,7 +4,7 @@ use warnings; use parent qw/Exporter/; our $VERSION = '5999.000_013'; -our @EXPORT = qw/dbinit purge db user_list user_entry problem_list problem_entry contest_list contest_entry contest_has_problem job_list job_entry create_job standings update_status rerun_job take_job finish_job open_problem/; ## no critic (ProhibitAutomaticExportation) +our @EXPORT = qw/dbinit purge db user_list user_entry problem_list problem_entry contest_list contest_entry contest_has_problem job_list job_entry create_job standings update_status rerun_job take_job finish_job open_problem/; our @EXPORT_OK = @EXPORT; use JSON::MaybeXS qw/decode_json/; @@ -279,8 +279,8 @@ sub finish_job { sub open_problem { my ($contest, $problem, $owner, $time) = @_; my $ct = contest_entry($contest); - return unless $ct->{id} && $time >= $ct->{start} && $time < $ct->{stop}; - eval { db->insert(opens => { + return unless $ct->{id} && $time >= $ct->{start} && $time < $ct->{stop}; ## no critic (ProhibitNegativeExpressionsInUnlessAndUntilConditions) + eval { db->insert(opens => { ## no critic (RequireCheckingReturnValueOfEval) contest => $contest, problem => $problem, owner => $owner, diff --git a/t/perlcriticrc b/t/perlcriticrc index eea00bd..766528d 100644 --- a/t/perlcriticrc +++ b/t/perlcriticrc @@ -7,11 +7,12 @@ severity = 1 [-Documentation::PodSpelling] [-Documentation::RequirePodLinksIncludeText] [-InputOutput::RequireBracedFileHandleWithPrint] +[-InputOutput::RequireCheckedSyscalls] [-Modules::ProhibitAutomaticExportation] -[-Modules::RequireExplicitPackage] [-References::ProhibitDoubleSigils] [-RegularExpressions::ProhibitEnumeratedClasses] [-RegularExpressions::ProhibitUnusualDelimiters] +[-RegularExpressions::RequireBracesForMultiline] [-RegularExpressions::RequireLineBoundaryMatching] [-Subroutines::RequireFinalReturn] [-ValuesAndExpressions::ProhibitConstantPragma] @@ -36,3 +37,6 @@ script_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE [Subroutines::RequireArgUnpacking] short_subroutine_statements = 5 allow_subscripts = 1 + +[TestingAndDebugging::ProhibitNoWarnings] +allow_with_category_restriction = 1