[Rt-commit] rtfm branch, 2.4/perlcritic, created. 2.4.3-6-g7fd1758

Kevin Falcone falcone at bestpractical.com
Thu Mar 3 15:46:14 EST 2011


The branch, 2.4/perlcritic has been created
        at  7fd1758890d58eb6fc8e76c03b95e9d6f96a4589 (commit)

- Log -----------------------------------------------------------------
commit f61576cd5521569d769a0acebbbe2ea767ccdc33
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Feb 28 17:19:33 2011 -0500

    Don't use UNIVERSAL::isa anymore

diff --git a/lib/RT/FM/ArticleCollection_Overlay.pm b/lib/RT/FM/ArticleCollection_Overlay.pm
index ce7062e..27805f2 100644
--- a/lib/RT/FM/ArticleCollection_Overlay.pm
+++ b/lib/RT/FM/ArticleCollection_Overlay.pm
@@ -275,7 +275,7 @@ sub LimitCustomField {
     if ( $args{'FIELD'} ) {
 
         my $field_id;
-        if (UNIVERSAL::isa($args{'FIELD'} ,'RT::CustomField')) {
+        if (eval { $args{'FIELD'}->isa('RT::CustomField') }) {
             $field_id = $args{'FIELD'}->id;
         } elsif($args{'FIELD'} =~ /^\d+$/) {
             $field_id = $args{'FIELD'};

commit 55b2ad41145ff2d0c2d438d0a765ff318b41365c
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Mar 3 15:43:24 2011 -0500

    Add strict and warnings

diff --git a/lib/RT/FM/Article.pm b/lib/RT/FM/Article.pm
index 706482b..345358b 100644
--- a/lib/RT/FM/Article.pm
+++ b/lib/RT/FM/Article.pm
@@ -65,6 +65,7 @@ RT::FM::Article
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::Article;
 use RT::FM::Record; 
diff --git a/lib/RT/FM/ArticleCollection.pm b/lib/RT/FM/ArticleCollection.pm
index 71134a7..1685342 100644
--- a/lib/RT/FM/ArticleCollection.pm
+++ b/lib/RT/FM/ArticleCollection.pm
@@ -67,6 +67,7 @@
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::ArticleCollection;
 
diff --git a/lib/RT/FM/Class.pm b/lib/RT/FM/Class.pm
index 4f990bd..e0af88a 100644
--- a/lib/RT/FM/Class.pm
+++ b/lib/RT/FM/Class.pm
@@ -65,6 +65,7 @@ RT::FM::Class
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::Class;
 use RT::FM::Record; 
diff --git a/lib/RT/FM/ClassCollection.pm b/lib/RT/FM/ClassCollection.pm
index 4df1753..2f34057 100644
--- a/lib/RT/FM/ClassCollection.pm
+++ b/lib/RT/FM/ClassCollection.pm
@@ -67,6 +67,7 @@
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::ClassCollection;
 
diff --git a/lib/RT/FM/ObjectTopic.pm b/lib/RT/FM/ObjectTopic.pm
index 955a08c..1b72af8 100644
--- a/lib/RT/FM/ObjectTopic.pm
+++ b/lib/RT/FM/ObjectTopic.pm
@@ -65,6 +65,7 @@ RT::FM::ObjectTopic
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::ObjectTopic;
 use RT::FM::Record; 
diff --git a/lib/RT/FM/ObjectTopicCollection.pm b/lib/RT/FM/ObjectTopicCollection.pm
index 64ddce8..ec39814 100644
--- a/lib/RT/FM/ObjectTopicCollection.pm
+++ b/lib/RT/FM/ObjectTopicCollection.pm
@@ -67,6 +67,7 @@
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::ObjectTopicCollection;
 
diff --git a/lib/RT/FM/Record.pm b/lib/RT/FM/Record.pm
index cc0473c..0beb983 100644
--- a/lib/RT/FM/Record.pm
+++ b/lib/RT/FM/Record.pm
@@ -60,6 +60,7 @@
 =cut
 
 
+use strict;
 no warnings 'redefine';
 package RT::FM::Record;
 use  base qw(RT::Record);
diff --git a/lib/RT/FM/SearchBuilder.pm b/lib/RT/FM/SearchBuilder.pm
index 761f3fb..240ae63 100644
--- a/lib/RT/FM/SearchBuilder.pm
+++ b/lib/RT/FM/SearchBuilder.pm
@@ -58,6 +58,7 @@
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::SearchBuilder;
 use base qw(RT::SearchBuilder);
@@ -116,7 +117,7 @@ sub HasEntry {
     my @items = grep {$_->Id == $id } @{$self->ItemsArrayRef};
    
     if ($#items > 1) {
-	die "$self HasEntry had a list with more than one of $item in it. this can never happen";
+	die "$self HasEntry had a list with more than one of @items in it. this can never happen";
     }
     
     if ($#items == -1 ) {
diff --git a/lib/RT/FM/Topic.pm b/lib/RT/FM/Topic.pm
index c8f3da6..2e6b885 100644
--- a/lib/RT/FM/Topic.pm
+++ b/lib/RT/FM/Topic.pm
@@ -65,6 +65,7 @@ RT::FM::Topic
 
 =cut
 
+use strict;
 no warnings 'redefine';
 package RT::FM::Topic;
 use RT::FM::Record; 
diff --git a/lib/RT/FM/TopicCollection.pm b/lib/RT/FM/TopicCollection.pm
index b2b15d6..3b9a696 100644
--- a/lib/RT/FM/TopicCollection.pm
+++ b/lib/RT/FM/TopicCollection.pm
@@ -72,6 +72,8 @@ package RT::FM::TopicCollection;
 use RT::FM::SearchBuilder;
 use RT::FM::Topic;
 
+use strict;
+use warnings;
 use base qw(RT::FM::SearchBuilder);
 
 

commit 7fd1758890d58eb6fc8e76c03b95e9d6f96a4589
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Mar 3 15:45:57 2011 -0500

    use RT's perlcriticrc

diff --git a/.perlcriticrc b/.perlcriticrc
new file mode 100644
index 0000000..bcb3507
--- /dev/null
+++ b/.perlcriticrc
@@ -0,0 +1,45 @@
+# space separated list of strings to regex match against rules
+exclude = Modules::RequireFilenameMatchesPackage Subroutines::ProhibitExplicitReturnUndef Subroutines::RequireArgUnpacking
+
+# [Modules::RequireFilenameMatchesPackage]
+# versions up to RT 3.8 use _Overlay files to separate generated code
+# from core code, as such there are a lot of needless warnings about
+# this.  These were removed in 4.0 so skipping this will not be required
+#
+# [Subroutines::ProhibitExplicitReturnUndef] 
+# RT is documented to return undef in a number of places, and on a
+# stable series I'm hesitant to go around changing to implicitly return
+# undef.  We can clean this up in 4.0 and ensure that if something
+# calling us in list context really needs that explicit undef, it
+# doesn't break on a minor release upgrade.
+#
+# [Subroutines::RequireArgUnpacking]
+# RT is a big user of my $self = shift; and will continue doing so
+#
+
+# 3.8 hasn't converted to using RT->SystemUser and the like and still reaches
+# for RT:: in a lot of places.  Quiet that down with what seems like a slightly
+# larger hammer than I would like.
+#
+# Eliminate globals declared with `our' or `use vars'.
+[Variables::ProhibitPackageVars]
+# set_themes                         = core maintenance pbp
+# add_themes                         =
+# severity                           = 3
+# maximum_violations_per_document    = no_limit
+
+# The base set of packages to allow variables for.
+# packages = Data::Dumper File::Find FindBin Log::Log4perl
+
+# The set of packages to allow variables for, in addition to those given in "packages".
+add_packages = RT
+
+# Write `eval { my $foo; bar($foo) }' instead of `eval "my $foo; bar($foo);"'.
+[BuiltinFunctions::ProhibitStringyEval]
+# set_themes                         = bugs core pbp
+# add_themes                         =
+# severity                           = 5
+# maximum_violations_per_document    = no_limit
+
+# Allow eval of "use" and "require" strings.
+allow_includes = 1

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


More information about the Rt-commit mailing list