[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-51-gb5fa884

Alex Vandiver alexmv at bestpractical.com
Wed Jul 6 19:54:43 EDT 2011


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

Summary of changes:
 bin/rt.in                    |    6 +++---
 lib/RT/Attributes_Overlay.pm |    2 +-
 lib/RT/I18N.pm               |    2 +-
 lib/RT/Interface/Web.pm      |    6 +++---
 lib/RT/Queue_Overlay.pm      |    2 +-
 lib/RT/Record.pm             |    2 +-
 lib/RT/Templates_Overlay.pm  |    2 +-
 lib/RT/Ticket_Overlay.pm     |    4 +++-
 lib/RT/Users_Overlay.pm      |    2 +-
 sbin/extract-message-catalog |    6 +++---
 10 files changed, 18 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit b5fa88487d12b157897519525a99ed99270576e3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 19:39:48 2011 -0400

    Resolve mixed high and low precedence boolean operators, in favor of low-precedence

diff --git a/bin/rt.in b/bin/rt.in
index f0f8a5b..a446f03 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -316,7 +316,7 @@ sub list {
             $bad = 1; last;
         }
     }
-    if ( ! $rawprint and ! exists $data{format} ) {
+    unless ( $rawprint or exists $data{format} ) {
         $data{format} = 'l';
     }
     if ( $reverse_sort and $data{orderby} =~ /^-/ ) {
@@ -1675,7 +1675,7 @@ sub date_diff {
     $new = time() if ! $new;
     $old = str2time($old) if $old !~ /^\d+$/;
     $new = str2time($new) if $new !~ /^\d+$/;
-    return "???" if ! $old or ! $new;
+    return "???" if not $old or not $new;
 
     my %seconds = (min => 60,
                    hr  => 60*60,
@@ -1711,7 +1711,7 @@ sub prettyshow {
     # dates in these attributes are in GMT and will be converted
     foreach my $form (@$forms) {
         my ($c, $o, $k, $e) = @$form;
-        next if ! $k->{id} or exists $k->{Queue};
+        next if not $k->{id} or exists $k->{Queue};
         if ( exists $k->{Created} ) {
             my ($y,$m,$d,$hh,$mm,$ss) = ($k->{Created} =~ /(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/);
             $m--;
diff --git a/lib/RT/Attributes_Overlay.pm b/lib/RT/Attributes_Overlay.pm
index f69f97a..5665237 100644
--- a/lib/RT/Attributes_Overlay.pm
+++ b/lib/RT/Attributes_Overlay.pm
@@ -172,7 +172,7 @@ sub DeleteEntry {
     );
     my $found = 0;
     foreach my $attr ( $self->Named( $args{'Name'} ) ) {
-        if ( ( !defined $args{'id'} and !defined $args{'Content'} )
+        if ( ( not defined $args{'id'} and not defined $args{'Content'} )
              or ( defined $args{'id'} and $attr->id eq $args{'id'} )
              or ( defined $args{'Content'} and $attr->Content eq $args{'Content'} ) )
         {
diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index 0164448..42263eb 100755
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -423,7 +423,7 @@ sub _FindOrGuessCharset {
         return $charset;
     }
 
-    if ( !$head_only and $head->mime_type =~ m{^text/}) {
+    if ( not $head_only and $head->mime_type =~ m{^text/}) {
 	my $body = $entity->bodyhandle or return;
 	return _GuessCharset( $body->as_string );
     }
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index b6ffccc..29ce1c2 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -141,8 +141,8 @@ sub WebExternalAutoInfo {
 
     # default to making Privileged users, even if they specify
     # some other default Attributes
-    if ( !$RT::AutoCreate
-        || ( ref($RT::AutoCreate) && not exists $RT::AutoCreate->{Privileged} ) )
+    if ( not $RT::AutoCreate
+        or ( ref($RT::AutoCreate) and not exists $RT::AutoCreate->{Privileged} ) )
     {
         $user_info{'Privileged'} = 1;
     }
@@ -1933,7 +1933,7 @@ sub _ProcessObjectCustomFieldUpdates {
             # keep everything up to the point of difference, delete the rest
             my $delete_flag;
             foreach my $old_cf ( @{ $cf_values->ItemsArrayRef } ) {
-                if ( !$delete_flag and @values and $old_cf->Content eq $values[0] ) {
+                if ( not $delete_flag and @values and $old_cf->Content eq $values[0] ) {
                     shift @values;
                     next;
                 }
diff --git a/lib/RT/Queue_Overlay.pm b/lib/RT/Queue_Overlay.pm
index e4e6ad8..00df1d5 100755
--- a/lib/RT/Queue_Overlay.pm
+++ b/lib/RT/Queue_Overlay.pm
@@ -886,7 +886,7 @@ sub DeleteWatcher {
         return ( 0, $self->loc("No principal specified") );
     }
 
-    if ( !$args{PrincipalId} and $args{Email} ) {
+    if ( not $args{PrincipalId} and $args{Email} ) {
         my $user = RT::User->new( $self->CurrentUser );
         my ($rv, $msg) = $user->LoadByEmail( $args{Email} );
         $args{PrincipalId} = $user->PrincipalId if $rv;
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index c85c879..3d28fab 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -734,7 +734,7 @@ sub _EncodeLOB {
         #database doesn't support embedded nulls
 
         if ( RT->Config->Get('AlwaysUseBase64') or
-             ( !$RT::Handle->BinarySafeBLOBs ) && ( $Body =~ /\x00/ ) ) {
+             ( not $RT::Handle->BinarySafeBLOBs and $Body =~ /\x00/ ) ) {
 
             # set a flag telling us to mimencode the attachment
             $ContentEncoding = 'base64';
diff --git a/lib/RT/Templates_Overlay.pm b/lib/RT/Templates_Overlay.pm
index a8bff1c..142eb43 100755
--- a/lib/RT/Templates_Overlay.pm
+++ b/lib/RT/Templates_Overlay.pm
@@ -177,7 +177,7 @@ sub Next {
         
         # If it's part of a queue, and the user can read templates in
         # that queue, or the user can globally read templates, show it
-        if ($templ->Queue && $templ->CurrentUserHasQueueRight('ShowTemplate') or
+        if (($templ->Queue and $templ->CurrentUserHasQueueRight('ShowTemplate')) or
             $templ->CurrentUser->HasRight(Object => $RT::System, Right => 'ShowTemplate')) {
 	    return($templ);
 	}
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index b75510c..f9063fd 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -1650,7 +1650,9 @@ sub TransactionAddresses {
         foreach my $addrlist ( values %$txnaddrs ) {
                 foreach my $addr (@$addrlist) {
                     # Skip addresses without a phrase (things that are just raw addresses) if we have a phrase
-                    next if ($addresses{$addr->address} && $addresses{$addr->address}->phrase && not $addr->phrase);
+                    next if ($addresses{$addr->address}
+                         and $addresses{$addr->address}->phrase
+                         and not $addr->phrase);
                     # skips "comment-only" addresses
                     next unless ($addr->address);
                     $addresses{$addr->address} = $addr;
diff --git a/lib/RT/Users_Overlay.pm b/lib/RT/Users_Overlay.pm
index c9ebb92..61ad269 100755
--- a/lib/RT/Users_Overlay.pm
+++ b/lib/RT/Users_Overlay.pm
@@ -444,7 +444,7 @@ sub _RoleClauses {
     foreach my $obj ( @objects ) {
         my $type = ref($obj)? ref($obj): $obj;
         my $id;
-        $id = $obj->id if Scalar::Util::blessed($obj) and $obj->can('id') && $obj->id;
+        $id = $obj->id if Scalar::Util::blessed($obj) and $obj->can('id') and $obj->id;
 
         my $role_clause = "$groups.Domain = '$type-Role'";
         # XXX: Groups.Instance is VARCHAR in DB, we should quote value
diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index 0f7d085..ea75045 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -246,7 +246,7 @@ sub update {
     my ( %Lexicon, %Header);
     my $out = '';
 
-    unless (!-e $file or -w $file) {
+    if (-e $file and not -w $file) {
 	warn "Can't write to $lang, skipping...\n";
 	return;
     }
@@ -320,12 +320,12 @@ sub update {
         my $nospace = $_;
         $nospace =~ s/ +$//;
 
-        if ( !$Lexicon{$_} and $Lexicon{$nospace} ) {
+        if ( not $Lexicon{$_} and $Lexicon{$nospace} ) {
             $Lexicon{$_} =
               $Lexicon{$nospace} . ( ' ' x ( length($_) - length($nospace) ) );
         }
 
-        next if !length( $Lexicon{$_} ) and $is_english;
+        next if not length( $Lexicon{$_} ) and $is_english;
 
         my %seen;
         $out .= $Header{$_} if exists $Header{$_};

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


More information about the Rt-commit mailing list