[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-50-g2fe4b23

Alex Vandiver alexmv at bestpractical.com
Wed Jul 6 19:25:26 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  2fe4b23b838194a56dd07a90899d5d1bd73bf96c (commit)
       via  5dff2aa49e2dcdf4b4596375ae4d82782b907376 (commit)
      from  b32a6cc69d5063514e1401eba5e1b53587bd42de (commit)

Summary of changes:
 bin/rt.in                            |   35 +++++++++++++++++++++++++++------
 lib/RT/Approval/Rule/NewPending.pm   |    5 +++-
 lib/RT/CustomFieldValues/External.pm |    3 +-
 lib/RT/Report/Tickets.pm             |    2 +-
 lib/RT/Tickets_Overlay.pm            |    8 +++++-
 lib/RT/User_Overlay.pm               |   11 ++++-----
 6 files changed, 46 insertions(+), 18 deletions(-)

- Log -----------------------------------------------------------------
commit 5dff2aa49e2dcdf4b4596375ae4d82782b907376
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 19:21:59 2011 -0400

    Remove instances of comma-as-statement-separator

diff --git a/bin/rt.in b/bin/rt.in
index 292fa48..f0f8a5b 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -274,10 +274,16 @@ sub list {
         $_ = shift @ARGV;
 
         if (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-S$/) {
-            $bad = 1, last unless get_var_argument(\%data);
+            unless (get_var_argument(\%data)) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-o$/) {
             $data{'orderby'} = shift @ARGV;
@@ -372,10 +378,16 @@ sub show {
         $_ = shift @ARGV;
         s/^#// if /^#\d+/; # get rid of leading hash
         if (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-S$/) {
-            $bad = 1, last unless get_var_argument(\%data);
+            unless (get_var_argument(\%data)) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-([isl])$/) {
             $data{format} = $1;
@@ -477,10 +489,16 @@ sub edit {
         elsif (/^-i$/) { $input = 1 }
         elsif (/^-o$/) { $output = 1 }
         elsif (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-S$/) {
-            $bad = 1, last unless get_var_argument(\%data);
+            unless (get_var_argument(\%data)) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-$/ && !($slurped || $input)) {
             chomp(my @lines = <STDIN>);
@@ -884,7 +902,10 @@ sub link_ticket {
             $del = 1;
         }
         elsif (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         else {
             whine "Unrecognised option: '$_'.";
diff --git a/lib/RT/Approval/Rule/NewPending.pm b/lib/RT/Approval/Rule/NewPending.pm
index 11214ef..8cb21dd 100644
--- a/lib/RT/Approval/Rule/NewPending.pm
+++ b/lib/RT/Approval/Rule/NewPending.pm
@@ -67,7 +67,10 @@ sub Commit {
     my $t = $self->TicketObj->Transactions;
     my $to;
     while ( my $o = $t->Next ) {
-        $to = $o, last if $o->Type eq 'Create';
+        if ($o->Type eq 'Create') {
+            $to = $o;
+            last;
+        }
     }
 
     # XXX: this makes the owner incorrect so notify owner won't work
diff --git a/lib/RT/User_Overlay.pm b/lib/RT/User_Overlay.pm
index ebc35ad..007a74b 100755
--- a/lib/RT/User_Overlay.pm
+++ b/lib/RT/User_Overlay.pm
@@ -906,13 +906,12 @@ sub GenerateRandomPassword {
 sub _GenerateRandomNextChar {
     my $self = shift;
     my ( $all, $freq ) = @_;
-    my ( $pos, $i );
 
-    for ( $pos = int( rand($all) ), $i = 0 ;
-        $pos >= $freq->[$i] ;
-        $pos -= $freq->[$i], $i++ )
-    {
-    }
+    my $pos = int( rand($all) );
+    my $i = 0;
+
+    $pos -= $freq->[$i++]
+        while $pos >= $freq->[$i];
 
     return ($i);
 }

commit 2fe4b23b838194a56dd07a90899d5d1bd73bf96c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 19:22:41 2011 -0400

    Rejigger some commas which perlcritic mistook for statement separators

diff --git a/lib/RT/CustomFieldValues/External.pm b/lib/RT/CustomFieldValues/External.pm
index 81aaa2b..0a6af1f 100644
--- a/lib/RT/CustomFieldValues/External.pm
+++ b/lib/RT/CustomFieldValues/External.pm
@@ -190,7 +190,8 @@ sub _DoSearch {
     my $check = $self->__BuildAggregatorsCheck;
     foreach( @{ $self->ExternalValues } ) {
         my $value = $self->NewItem;
-        $value->LoadFromHash( { %defaults, %$_ } );
+        my %load = ( %defaults, %{$_} );
+        $value->LoadFromHash( \%load );
         next if $check && !$check->( $self, $value );
         $self->AddRecord( $value );
     }
diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index c601485..d229667 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -57,7 +57,7 @@ use warnings;
 sub Groupings {
     my $self = shift;
     my %args = (@_);
-    my @fields = map {$_, $_} qw(
+    my @fields = map {$_ => $_} qw(
         Status
         Queue
     );
diff --git a/lib/RT/Tickets_Overlay.pm b/lib/RT/Tickets_Overlay.pm
index f3e70f9..97b60e7 100755
--- a/lib/RT/Tickets_Overlay.pm
+++ b/lib/RT/Tickets_Overlay.pm
@@ -1827,8 +1827,12 @@ Returns a frozen string suitable for handing back to ThawLimits.
 =cut
 
 sub _FreezeThawKeys {
-    'TicketRestrictions', 'restriction_index', 'looking_at_effective_id',
-        'looking_at_type';
+    return qw/
+                 TicketRestrictions
+                 restriction_index
+                 looking_at_effective_id
+                 looking_at_type
+             /;
 }
 
 # {{{ sub FreezeLimits

-----------------------------------------------------------------------


More information about the Rt-commit mailing list