summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Dumont <dod@debian.org>2021-06-04 18:50:34 +0200
committerDominique Dumont <dod@debian.org>2021-06-04 18:50:34 +0200
commit90d82da4620fc7798f984ca844a929b1a110519a (patch)
tree0e9e99d8b030bd4edd8b33446e8e881d2478e566
parent36aadb7477484535f6e72080e59342df12020f8f (diff)
add perl critic author tests
-rw-r--r--t/perl-critic.t21
-rw-r--r--t/perlcriticrc13
2 files changed, 34 insertions, 0 deletions
diff --git a/t/perl-critic.t b/t/perl-critic.t
new file mode 100644
index 00000000..1ee564e2
--- /dev/null
+++ b/t/perl-critic.t
@@ -0,0 +1,21 @@
+ use strict;
+ use warnings;
+ use File::Spec;
+ use Test::More;
+ use English qw(-no_match_vars);
+
+ if ( not $ENV{TEST_AUTHOR} ) {
+ my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.';
+ plan( skip_all => $msg );
+ }
+
+ eval { require Test::Perl::Critic; };
+
+ if ( $EVAL_ERROR ) {
+ my $msg = 'Test::Perl::Critic required to criticise code';
+ plan( skip_all => $msg );
+ }
+
+ my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
+ Test::Perl::Critic->import( -profile => $rcfile );
+ all_critic_ok();
diff --git a/t/perlcriticrc b/t/perlcriticrc
new file mode 100644
index 00000000..cd73054b
--- /dev/null
+++ b/t/perlcriticrc
@@ -0,0 +1,13 @@
+severity = 4
+
+# remove when https://github.com/Perl-Critic/PPI/issues/194 is fixed
+[-Subroutines::ProhibitSubroutinePrototypes]
+
+[TestingAndDebugging::ProhibitNoWarnings]
+allow = experimental::postderef experimental::signatures
+
+# model files are not modules
+[-Modules::RequireExplicitPackage]
+
+# model files finish with a data structure: the model
+[-Modules::RequireEndWithOne]