[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-66-g2d287dc

Alex Vandiver alexmv at bestpractical.com
Thu Jul 21 19:25:28 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  2d287dc8f83605f3c0cf340486636a4f58178742 (commit)
      from  94bebef1f9ceb6804769cdaa87f07d21ab923a2c (commit)

Summary of changes:
 lib/RT/I18N.pm                             |    9 ++++-----
 lib/RT/Interface/Web.pm                    |    4 ++--
 lib/RT/Tickets_Overlay_SQL.pm              |    4 +---
 sbin/rt-clean-sessions.in                  |    7 ++++---
 sbin/rt-email-dashboards.in                |    4 +---
 sbin/rt-test-dependencies.in               |    2 +-
 share/html/Admin/Groups/Members.html       |    2 +-
 share/html/Admin/Tools/Shredder/index.html |    2 +-
 share/html/Approvals/index.html            |    2 +-
 share/html/Search/Simple.html              |    5 +++--
 share/html/User/Delegation.html            |    8 ++++----
 11 files changed, 23 insertions(+), 26 deletions(-)

- Log -----------------------------------------------------------------
commit 2d287dc8f83605f3c0cf340486636a4f58178742
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 21 17:52:00 2011 -0400

    Revert some of the more questionable changes which were made due to tool failure

diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index 7cc6cfe..42263eb 100755
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -101,16 +101,15 @@ sub Init {
 
     # Load language-specific functions
     foreach my $file ( File::Glob::bsd_glob(substr(__FILE__, 0, -3) . "/*.pm") ) {
-        my ($clean) = $file =~ /^([-\w\s\.\/\\~:]+)$/;
-
-        unless ( $clean ) {
+        unless ( $file =~ /^([-\w\s\.\/\\~:]+)$/ ) {
             warn("$file is tainted. not loading");
             next;
         }
+        $file = $1;
 
-        my ($lang) = ($clean =~ /([^\\\/]+?)\.pm$/);
+        my ($lang) = ($file =~ /([^\\\/]+?)\.pm$/);
         next unless grep $_ eq '*' || $_ eq $lang, @lang;
-        require $clean;
+        require $file;
     }
 
     my %import;
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 47c7b54..0ad663e 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1552,7 +1552,7 @@ sub ProcessACLChanges {
     my @results;
 
     foreach my $arg ( keys %$ARGSref ) {
-        $arg =~ /^(GrantRight|RevokeRight)-(\d+)-(.+?)-(\d+)$/ or next;
+        next unless ( $arg =~ /^(GrantRight|RevokeRight)-(\d+)-(.+?)-(\d+)$/ );
 
         my ( $method, $principal_id, $object_type, $object_id ) = ( $1, $2, $3, $4 );
 
@@ -2290,7 +2290,7 @@ container object and the search id.
 sub _parse_saved_search {
     my $spec = shift;
     return unless $spec;
-    $spec =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ or return;
+    return unless $spec =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/;
 
     my $obj_type  = $1;
     my $obj_id    = $2;
diff --git a/lib/RT/Tickets_Overlay_SQL.pm b/lib/RT/Tickets_Overlay_SQL.pm
index 4973fe0..b6ef5e5 100755
--- a/lib/RT/Tickets_Overlay_SQL.pm
+++ b/lib/RT/Tickets_Overlay_SQL.pm
@@ -188,9 +188,7 @@ sub _parser {
 
         # key has dot then it's compound variant and we have subkey
         my $subkey = '';
-        if ( $key =~ /^([^\.]+)\.(.+)$/ ) {
-            ($key, $subkey) = ($1, $2);
-        }
+        ($key, $subkey) = ($1, $2) if $key =~ /^([^\.]+)\.(.+)$/;
 
         # normalize key and get class (type)
         my $class;
diff --git a/sbin/rt-clean-sessions.in b/sbin/rt-clean-sessions.in
index f5e9240..9ededb2 100644
--- a/sbin/rt-clean-sessions.in
+++ b/sbin/rt-clean-sessions.in
@@ -86,9 +86,10 @@ if ( $opt{help} ) {
 
 
 if( $opt{'older'} ) {
-    $opt{'older'} =~ /^\s*([0-9]+)\s*(H|D|M|Y)?$/i
-        or die "wrong format of the 'older' argument\n";
-
+    unless( $opt{'older'} =~ /^\s*([0-9]+)\s*(H|D|M|Y)?$/i ) {
+        print STDERR "wrong format of the 'older' argumnet\n";
+        exit(1);
+    }
     my ($num,$unit) = ($1, uc($2 ||'D'));
     my %factor = ( H => 60*60 );
     $factor{'D'} = $factor{'H'}*24;
diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 85957c5..fccf339 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -464,9 +464,7 @@ sub get_resource {
     $content = run_component($path, %args);
 
     # guess at the filename from the component name
-    if ( $path =~ m{^.*/(.*?)$} ) {
-        $filename = $1;
-    }
+    $filename = $1 if $path =~ m{^.*/(.*?)$};
 
     # the rest of this was taken from Email::MIME::CreateHTML::Resolver::LWP
     ($mimetype, $encoding) = MIME::Types::by_suffix($filename);
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index c638bf6..7825b5a 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -395,7 +395,7 @@ check_users();
 
 my %Missing_By_Type = ();
 foreach my $type (sort grep $args{$_}, keys %args) {
-    $type =~ /^with-(.*?)$/ or next;
+    next unless ($type =~ /^with-(.*?)$/);
 
     $type = $1;
     section("$type dependencies");
diff --git a/share/html/Admin/Groups/Members.html b/share/html/Admin/Groups/Members.html
index f8245e6..b1bfe93 100755
--- a/share/html/Admin/Groups/Members.html
+++ b/share/html/Admin/Groups/Members.html
@@ -123,7 +123,7 @@ my (@results);
 
 # XXX: safe member id in value instead of name
 foreach my $key (keys %ARGS) {
-    $key =~ /^DeleteMember-(\d+)$/ or next;
+    next unless $key =~ /^DeleteMember-(\d+)$/;
 
     my ($val,$msg) = $Group->DeleteMember($1);
     push (@results, $msg);
diff --git a/share/html/Admin/Tools/Shredder/index.html b/share/html/Admin/Tools/Shredder/index.html
index 29a3ce2..acb956d 100644
--- a/share/html/Admin/Tools/Shredder/index.html
+++ b/share/html/Admin/Tools/Shredder/index.html
@@ -107,7 +107,7 @@ if( $Plugin ) { { # use additional block({}) to effectively exit block on errors
 
     my %args;
     foreach my $k( keys %ARGS ) {
-        $k =~ /^\Q$Plugin\E:(.*)$/ or next;
+        next unless $k =~ /^\Q$Plugin\E:(.*)$/;
         $args{ $1 } = $ARGS{$k};
     }
     ( $status, $msg ) = $plugin_obj->HasSupportForArgs( keys %args );
diff --git a/share/html/Approvals/index.html b/share/html/Approvals/index.html
index 04f0c4e..cfd5ab4 100755
--- a/share/html/Approvals/index.html
+++ b/share/html/Approvals/index.html
@@ -58,7 +58,7 @@
 my (@actions);
 foreach my $arg ( keys %ARGS ) {
 
-    $arg =~ /Approval-(\d+)-Action/ or next;
+    next unless ( $arg =~ /Approval-(\d+)-Action/ );
 
     my ( $notesval, $notesmsg );
 
diff --git a/share/html/Search/Simple.html b/share/html/Search/Simple.html
index 3673867..08945e5 100644
--- a/share/html/Search/Simple.html
+++ b/share/html/Search/Simple.html
@@ -81,8 +81,9 @@ if ($q) {
     my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
     $m->callback( %ARGS, query => \$q, CallbackName => 'ModifyQuery' );
 
-    RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Ticket/Display.html?id=".$q)
-          if $q =~ s/^#?(\d+)$/$1/;
+    if ($q =~ /^#?(\d+)$/) {
+        RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Ticket/Display.html?id=".$1);
+    }
 
     my %args = (
         Argument   => $q,
diff --git a/share/html/User/Delegation.html b/share/html/User/Delegation.html
index 13b3e4a..d74e816 100755
--- a/share/html/User/Delegation.html
+++ b/share/html/User/Delegation.html
@@ -63,8 +63,8 @@
 
 my (@results);
 foreach my $arg (keys %ARGS) {
-    my ($parent, $principal, $delegation) =
-        $arg =~ /^Delegate-Existing-ACE-(\d+)-to-(\d+)-as-(\d+)$/ or next;
+    next unless ($arg =~ /^Delegate-Existing-ACE-(\d+)-to-(\d+)-as-(\d+)$/);
+    my ($parent, $principal, $delegation) = ($1, $2, $3);
     unless ($ARGS{"Delegate-ACE-$parent-to-$principal"}) {
         my $ace_to_del = RT::ACE->new($session{'CurrentUser'});
         $ace_to_del->Load($delegation);
@@ -74,8 +74,8 @@ foreach my $arg (keys %ARGS) {
 }
 
 foreach my $arg (keys %ARGS) {
-    my ($parent, $principal) =
-        $arg =~ /^Delegate-ACE-(\d+)-to-(\d+)$/ or next;
+    next unless ($arg =~ /^Delegate-ACE-(\d+)-to-(\d+)$/);
+    my ($parent, $principal) = ($1, $2);
     # if we already delegate it, we just don't care
     next if (grep /^Delegate-Existing-ACE-$parent-to-$principal-/, keys %ARGS);
     my $ace = RT::ACE->new($session{'CurrentUser'});

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


More information about the Rt-commit mailing list