[SCM] Debian package checker branch, master, updated. 2.4.3-161-g2d27e5d
The following commit has been merged in the master branch:
commit e798a3c3a7a5c686d9ef8f58bd0054869d272e1e
Author: Raphael Geissert <atomo64@gmail.com>
Date: Tue Jan 25 22:16:43 2011 -0600
Run a subset of Perl::Critic, if installed
I built a whitelist of things that should be trivial to fix, and a
blacklist of things we probably really don't want to fix.
The test is only run if Perl::Critic is installed and the changelog
entry is set to UNRELEASED, to avoid disruptions.
diff --git a/.perlcriticrc b/.perlcriticrc
new file mode 100644
index 0000000..325d956
--- /dev/null
+++ b/.perlcriticrc
@@ -0,0 +1,27 @@
+# FIXME: the list of checks should probably be moved to
+# t/scripts/critic.pl. Line continuations are not supported here
+
+# Severity is actually ignored for our main purposes, see below
+severity = 1
+# Work based on a whitelist
+only = 1
+# Our whitelist (ignores severity):
+include = MixedBooleanOperators ExplicitReturnUndef InteractiveTest GlobFunction UpperCaseHeredoc NegativeIndices PrivateVars UselessInitialization UnusedVariables ReusedNames PackageVars MatchVars ConditionalDeclarations NumberSeparators NullStatements LongChainsOfMethodCalls UseStrict UseWarnings SingleCharAlternation UnusedCapture FixedStringMatches EndWithOne ConditionalUseStatements TwoArgOpen PackageMatchesPodName JoinedReadline UnreachableCode QuotedWordLists TrailingWhitespace
+
+# If you want to try some other stuff, uncomment the following
+# (exclude is an incomplete list of things we probably won't change)
+# theme = security || bugs || complexity || maintenance
+# exclude = ExtendedFormat LineBoundaryMatch DotMatchAnything AutomaticExportation BuiltinHomonyms FinalReturn PunctuationVars InitializationForLocalVars UnusualDelimiters RcsKeywords
+# even more stuff if theme is empty
+
+# Would be nice to fix at some point:
+# include = ProhibitBarewordFileHandles
+# include = InterpolationOfLiterals
+# include = Capitalization
+
+criticism-fatal = 1
+color = 1
+allow-unsafe = 1
+
+[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
+allow_if_string_contains_single_quote = 1
diff --git a/t/scripts/critic.t b/t/scripts/critic.t
new file mode 100755
index 0000000..468e4e3
--- /dev/null
+++ b/t/scripts/critic.t
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More;
+
+sub should_skip($);
+
+plan skip_all => 'Only UNRELEASED versions are criticised'
+ if should_skip($ENV{'LINTIAN_ROOT'});
+
+eval 'use Test::Perl::Critic 1.00';
+plan skip_all => "Test::Perl::Critic 1.00 required to run this test" if $@;
+
+eval 'use PPIx::Regexp';
+diag('libppix-regexp-perl is needed to enable some checks') if $@;
+
+Test::Perl::Critic->import( -profile => "$ENV{LINTIAN_ROOT}/.perlcriticrc" );
+
+all_critic_ok("$ENV{LINTIAN_ROOT}/checks",
+ "$ENV{LINTIAN_ROOT}/lib",
+ "$ENV{LINTIAN_ROOT}/collection");
+
+
+sub should_skip($) {
+ my $path = shift;
+ my $skip = 1;
+ my $pid;
+
+ $pid = open (DPKG, '-|', 'dpkg-parsechangelog', '-c0',
+ "-l$path/debian/changelog");
+
+ die("failed to execute dpkg-parsechangelog: $!")
+ unless defined ($pid);
+
+ while (<DPKG>) {
+ $skip = 0 if m/^Distribution: UNRELEASED$/;
+ }
+
+ close(DPKG)
+ or die ("dpkg-parsechangelog returned: $?");
+
+ return $skip;
+}
--
Debian package checker
Reply to: