diff --git a/cpanfile b/cpanfile index 91b784fff..139dc6848 100644 --- a/cpanfile +++ b/cpanfile @@ -3,5 +3,6 @@ requires 'DBI', '>= 1.63'; requires 'JSON', '>= 2.97'; requires 'JSON::Parse', '>= 0.55'; requires 'List::Util', '>= 1.33'; +requires 'Perl::Critic'; requires 'String::Interpolate', '>= 0.33'; requires 'URI', '>= 1.72'; diff --git a/framework/test/test_style.sh b/framework/test/test_style.sh index 814e45619..8e5621406 100755 --- a/framework/test/test_style.sh +++ b/framework/test/test_style.sh @@ -4,6 +4,17 @@ TOPLEVEL="$(git rev-parse --show-toplevel)" cd "$TOPLEVEL" || (echo "Cannot cd to $TOPLEVEL" && exit 1) +# Check style of Perl scripts +find . \( -name '*.pm' -o -name '*.pl' \) -print0 | xargs -0 -n1 perl -Mstrict -Mdiagnostics -cw +grep -l --exclude-dir=project_repos --exclude=\*.pm --exclude=\*.pl --exclude=\*.sh --exclude=template -r "=pod" . | while IFS= read -r file ; do + perl -Mstrict -Mdiagnostics -cw "$file" +done +# Don't run perlcritic yet. +## Over time, reduce the severity number, eventually to 1. +# perlcritic --severity 5 "$TOPLEVEL"/framework +# Don't run perltidy yet. +# find . \( -name '*.pm' -o -name '*.pl' \) -print0 | xargs -0 perltidy -b + # Check style of sh scripts. grep -r -l '^\#! \?\(/bin/\|/usr/bin/env \)sh' --exclude=\*~ "$TOPLEVEL"/framework | while read -r line do