[Rt-commit] rtir branch, 2.6/perlcritic, created. 2.6.0-6-gf14b9d2
Kevin Falcone
falcone at bestpractical.com
Thu Mar 3 15:48:28 EST 2011
The branch, 2.6/perlcritic has been created
at f14b9d2ee703b659aac25fcb10689da529629c39 (commit)
- Log -----------------------------------------------------------------
commit 23fb773bfd8c2d5930d4e43dc698c0e665cd162f
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Mon Feb 28 14:43:32 2011 -0500
Fix up some warnings from perlcritic
Defining the VERSION too early and returning an explicit undef make it
cranky
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 19c5a4f..0328486 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -46,12 +46,13 @@
#
package RT::IR;
-our $VERSION = '2.6.0';
-
use 5.008003;
use warnings;
use strict;
+our $VERSION = '2.6.0';
+
+
use Business::Hours;
use Business::SLA;
@@ -150,7 +151,7 @@ sub OurQueue {
my $self = shift;
my $queue = shift;
$queue = $queue->Name if ref $queue;
- return undef unless $queue;
+ return unless $queue;
return '' unless $QUEUES{ lc $queue };
return $TYPE{ lc $queue };
}
@@ -172,7 +173,7 @@ sub TicketType {
$obj->Load( ref $arg{'Ticket'} ? $arg{'Ticket'}->id : $arg{'Ticket'} );
$arg{'Queue'} = $obj->QueueObj->Name if $obj->id;
}
- return undef unless defined $arg{'Queue'};
+ return unless defined $arg{'Queue'};
return $TYPE{ lc $arg{'Queue'} } if !ref $arg{'Queue'} && $arg{'Queue'} !~ /^\d+$/;
@@ -180,7 +181,7 @@ sub TicketType {
$obj->Load( ref $arg{'Queue'}? $arg{'Queue'}->id : $arg{'Queue'} );
return $TYPE{ lc $obj->Name } if $obj->id;
- return undef;
+ return;
}
=head2 States
@@ -213,7 +214,8 @@ sub States {
}
my %seen = ();
- return sort grep !$seen{$_}++, @states;
+ @states = sort grep !$seen{$_}++, @states;
+ return @states;
}
sub GetCustomField {
diff --git a/lib/RT/IR/Config.pm b/lib/RT/IR/Config.pm
index f14e7aa..4fb8062 100644
--- a/lib/RT/IR/Config.pm
+++ b/lib/RT/IR/Config.pm
@@ -1,4 +1,6 @@
package RT::IR::Config;
+use strict;
+use warnings;
sub Init {
use RT::Config;
commit f14b9d2ee703b659aac25fcb10689da529629c39
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Mar 3 15:47:28 2011 -0500
bring over RT's .perlcriticrc
diff --git a/.perlcriticrc b/.perlcriticrc
new file mode 100644
index 0000000..c3622e8
--- /dev/null
+++ b/.perlcriticrc
@@ -0,0 +1,41 @@
+# 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
+#
+
+# 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 =
+
+# 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