[SCM] UNNAMED PROJECT branch, master, updated. 0.43-9-g7b6ab0b

Niels Thykier niels at thykier.net
Thu Apr 25 18:54:48 UTC 2013


The following commit has been merged in the master branch:
commit 9621034226220fd61bab4a6a158ec4bedb0014a1
Author: Niels Thykier <niels at thykier.net>
Date:   Thu Apr 25 20:45:35 2013 +0200

    t: Add perlcritic test
    
    Signed-off-by: Niels Thykier <niels at thykier.net>

diff --git a/.perlcriticrc b/.perlcriticrc
new file mode 100644
index 0000000..5e66634
--- /dev/null
+++ b/.perlcriticrc
@@ -0,0 +1,49 @@
+# -*- conf -*-
+# FIXME: the list of checks should probably be moved to
+# t/scripts/critic.pl. Line continuations are not supported here
+
+verbose = 1
+# Severity is actually ignored for our main purposes, see below
+severity = 1
+# Work based on a whitelist
+only = 1
+# Our whitelist (ignores severity):
+include = ExplicitReturnUndef GlobFunction NegativeIndices PrivateVars UselessInitialization MatchVars NumberSeparators NullStatements LongChainsOfMethodCalls UseStrict UseWarnings EndWithOne ConditionalUseStatements PackageMatchesPodName JoinedReadline UnreachableCode TrailingWhitespace InterpolationOfLiterals ImplicitNewlines CommaSeparatedStatements UseStrict UseWarnings UnusedVariables UnusedCapture TwoArgOpen ProhibitHardTabs MismatchedOperators IndirectSyntax Modules:: BuiltinFunctions:: ClassHierarchies:: CommaSeparatedStatements QuotesAsQuotelikeOperatorDelimiters MixedBooleanOperators ProhibitBarewordFileHandles
+#include = MixedBooleanOperators InteractiveTest UpperCaseHeredoc ReusedNames PackageVars ConditionalDeclarations SingleCharAlternation FixedStringMatches ConditionalUseStatements QuotedWordLists
+
+exclude = RequireFilenameMatchesPackage RequireVersionVar ProhibitExcessMainComplexity ProhibitStringySplit ComplexMappings StringyEval
+
+# 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
+
+criticism-fatal = 1
+color = 1
+allow-unsafe = 1
+
+[BuiltinFunctions::ProhibitBooleanGrep]
+
+[InputOutput::RequireCheckedSyscalls]
+functions = open opendir chdir read readline closedir sysopen sysread sysclose close
+# possible TODO read readline readdir close closedir
+
+# We don't use package versions atm.
+[-Modules::RequireVersionVar]
+[-Modules::ProhibitExcessMainComplexity]
+
+[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
+allow_if_string_contains_single_quote = 1
+
+[ValuesAndExpressions::ProhibitCommaSeparatedStatements]
+allow_last_statement_to_be_comma_separated_in_map_and_grep = 1
+
+[-ValuesAndExpressions::ProhibitConstantPragma]
+
+[Variables::RequireLocalizedPunctuationVars]
+allow = %ENV %SIG $!
+
diff --git a/debian/control b/debian/control
index 235ffbf..11948b4 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Uploaders: Matthew Johnson <mjj29 at debian.org>, Niels Thykier <niels at thykier.net>
 Build-Depends: debhelper (>= 7.0.50~)
 Build-Depends-Indep: default-jdk, libarchive-zip-perl (>= 1.30-6~), markdown, perl,
      libtest-minimumversion-perl,
+     libtest-perl-critic-perl,
      libtest-strict-perl,
      perl (>= 5.12) | libtest-simple-perl (>= 0.93)
 Standards-Version: 3.9.3
diff --git a/t/critic.t b/t/critic.t
new file mode 100755
index 0000000..6871f07
--- /dev/null
+++ b/t/critic.t
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use autodie;
+
+use Test::More;
+
+plan skip_all => 'Only UNRELEASED versions are criticised'
+    if should_skip();
+
+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 => '.perlcriticrc' );
+
+all_critic_ok('.');
+done_testing;
+
+sub should_skip {
+    my $skip = 1;
+
+    open(my $fd, '-|', 'dpkg-parsechangelog', '-c0');
+
+    while (<$fd>) {
+	$skip = 0 if m/^Distribution: UNRELEASED$/;
+    }
+
+    close($fd);
+
+    return $skip;
+}

-- 
UNNAMED PROJECT



More information about the pkg-java-commits mailing list