Add Perl-Critic-Progressive unit test
authorDan Scott <dscott@laurentian.ca>
Sat, 13 Oct 2012 03:50:07 +0000 (23:50 -0400)
committerDan Scott <dscott@laurentian.ca>
Sat, 20 Apr 2013 15:40:53 +0000 (11:40 -0400)
This runs Perl::Critic at the 'gentle' level, recording the results in
the $HOME/evergreen directory. Each subsequent commit is checked against
the previous results; if the number of Perl::Critic violations
increases, then the test fails ... and the committer gets to clean
things up :)

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/perlmods/t/21-perl-critic.t [new file with mode: 0644]
Open-ILS/src/perlmods/t/perlcriticrc [new file with mode: 0644]

diff --git a/Open-ILS/src/perlmods/t/21-perl-critic.t b/Open-ILS/src/perlmods/t/21-perl-critic.t
new file mode 100644 (file)
index 0000000..188d94d
--- /dev/null
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+use File::Spec;
+use Test::More;
+
+eval { require Test::Perl::Critic::Progressive };
+plan skip_all => 'T::P::C::Progressive required for this test' if $@;
+
+my ($vol, $dir, $file) = File::Spec->splitpath(__FILE__);
+
+# History needs to be stored somewhere that will persist between
+# runs. In a CI environment, the source directory is likely to be
+# purged between runs - so pollute the user's home directory instead.
+my $history = $ENV{HOME} . '/.evergreen-tests';
+my $history_file = "$history/perlcritic-history";
+
+use Test::Perl::Critic::Progressive ( ':all' );
+set_critic_args(-profile => "$dir/../t/perlcriticrc");
+if (!-d $history) {
+    `mkdir $history`;
+}
+set_history_file($history_file);
+progressive_critic_ok("$dir/..");
diff --git a/Open-ILS/src/perlmods/t/perlcriticrc b/Open-ILS/src/perlmods/t/perlcriticrc
new file mode 100644 (file)
index 0000000..2c3506d
--- /dev/null
@@ -0,0 +1 @@
+severity = gentle