/usr/share/doc/libsvn-hooks-perl/examples/check-perl-critic.pl is in libsvn-hooks-perl 1.27-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Check if every added/changed Perl file respects Perl::Critic's code
# standards.
PRE_COMMIT {
my ($svnlook) = @_;
my %violations;
my $critic;
foreach my $file ($svnlook->added(), $svnlook->updated()) {
next unless $file =~ /\.p[lm]$/i;
require Perl::Critic;
$critic ||= Perl::Critic->new(-severity => 'stern', -top => 10);
my $contents = $svnlook->cat($file);
my @violations = $critic->critique(\$contents);
$violations{$file} = \@violations if @violations;
}
if (%violations) {
# FIXME: this is a lame way to format the output.
require Data::Dumper;
die "Perl::Critic Violations:\n", Data::Dumper::Dumper(\%violations), "\n";
}
};
1;
|