Permalink
Browse files

use local .perlcriticrc and .perltidyrc files, more generic search pa…

…th for critical test files
  • Loading branch information...
1 parent 715ebca commit 540ea3d22fa9bef75edf7d3722a35180b62ac637 Alexis Sukrieh committed Aug 16, 2010
Showing with 12 additions and 5 deletions.
  1. +12 −5 hooks/pre-commit.critical
@@ -10,13 +10,20 @@ die() {
}
# perltidy
-find lib -type f -exec perltidy -pro=/etc/perltidyrc {} \;
+for file in `git status|grep .pm|awk '{print $3}'`
+do
+ echo "perltidy $file"
+ perltidy -pro=.perltidyrc $file
+ if [[ $? != 0 ]]; then
+ die "Perltidy error in file: $file"
+ fi
+done
find lib -type f -name '*.bak' -exec rm -f {} \;
# Perl::Critic
-for file in `find lib -type f`
+for file in `git status|grep .pm|awk '{print $3}'`
do
- perlcritic --profile /etc/perlcriticrc $file
+ perlcritic --profile .perlcriticrc $file
if [[ $? != 0 ]]; then
die "Perl::Critic violation detected in $file"
fi
@@ -31,9 +38,9 @@ elif [[ $(echo $test_dir/*.t) == "$test_dir/*.t" ]]; then
# ^ This code depends on the fact that a glob pattern that matches no files,
# e.g. ../../t/*, will expand to the pattern itself--a literal '../../t/*'.)
else
- for script in t/00*.t
+ for script in `find t -type f -name '00*.t'`
do
- perl -Ilib -T $script > /dev/null
+ perl -Ilib $script > /dev/null
if [[ $? != 0 ]]; then
die 'Perl test suite failed'
fi

0 comments on commit 540ea3d

Please sign in to comment.