Add perlcritic tests and make code clean
[mafia.git] / lib / Mafia.pm
index 2b943b4ddf7b6f68448cd3f73ecf547644e8ad15..5c3f788d2a04006d31fa8c1a9c2d62fc6195c147 100644 (file)
@@ -29,7 +29,7 @@ BEGIN {
        defconst qw/ACT_KILL ACT_LYNCH ACT_PROTECT ACT_GUARD ACT_ROLEBLOCK ACT_GUNCHECK ACT_TRACK ACT_WATCH ACT_ROLECOP ACT_COP ACT_TRACK_RESULT ACT_WATCH_RESULT ACT_HIDE/;
 }
 
-use constant +{
+use constant +{ ## no critic (Capitalization)
        townie => town,
        ROLE => [vanilla, goon, doctor, vigilante, roleblocker, jailkeeper, gunsmith, tracker, watcher, bodyguard, rolecop, cop, sk, hider],
        FACTION => [mafia, town],
@@ -46,7 +46,7 @@ my %INVESTIGATIVE_ACTIONS_HASH = map { $_ => 1 } @{INVESTIGATIVE_ACTIONS()};
 my %GUNROLES_HASH = map { $_ => 1 } @{GUNROLES()};
 
 our @EXPORT = do {
-       no strict 'refs';
+       no strict 'refs'; ## no critic (ProhibitNoStrict)
        grep { $_ !~ [qw/import/] and exists &$_ } keys %{__PACKAGE__ . '::'};
 };
 
@@ -83,7 +83,7 @@ sub phase {
        return "Night $nightcnt" unless $isday;
 }
 
-sub rolename {
+sub rolename { ## no critic (RequireArgUnpacking)
        my %player = %{$players{$_[0]}};
        my ($faction, $role) = ($player{faction}, $player{role});
        if (defined $faction && $faction eq town && $role eq vanilla) {
@@ -118,7 +118,7 @@ sub msg {
 
                MSG_PLAYERS_ALIVE => sub {
                        @args = sort @args;
-                       say "Players alive: ", join ', ', @args
+                       say 'Players alive: ', join ', ', @args
                },
 
                MSG_DEATH => sub {
@@ -186,7 +186,7 @@ sub putaction {
        push @{$actions[$delay]->{$type}}, \%args
 }
 
-sub doaction {
+sub doaction { ## no critic (ProhibitExcessComplexity)
        my ($type, $args) = @_;
        my %args = %$args;
        my $source = $args{source};
@@ -201,10 +201,10 @@ sub doaction {
                # Copy this action to everybody hiding behind $target
                if (exists $tplayers{$target}{hiders}) {
                        for my $target (@{$tplayers{$target}{hiders}}) {
-                               my %args = %args;
-                               $args{target} = $target;
-                               $args{hidepierce} = 1;
-                               doaction($type, \%args);
+                               my %new_args = %args;
+                               $new_args{target} = $target;
+                               $new_args{hidepierce} = 1;
+                               doaction($type, \%new_args);
                        }
                }
 
@@ -446,7 +446,7 @@ Mafia - easily moderate Mafia games
 
   night;
 
-=head1 DESCRPTION
+=head1 DESCRIPTION
 
 Mafia.pm is a Perl extension for easily moderating Mafia games. You don't even need to know Perl to use it (see L<"WHAT YOU NEED TO KNOW"> for details).
 
This page took 0.011589 seconds and 4 git commands to generate.