diff --git a/src/tools/pgperlcritic/perlcriticrc b/src/tools/pgperlcritic/perlcriticrc new file mode 100644 index 00000000000..1059002ad50 --- /dev/null +++ b/src/tools/pgperlcritic/perlcriticrc @@ -0,0 +1,14 @@ +###################################################################### +# +# src/tools/pgperlcritic/perlcriticrc +# +# config file for perlcritic for Postgres project +# +##################################################################### + +severity = 5 + +theme = core + +# allow octal constants with leading zeros +[-ValuesAndExpressions::ProhibitLeadingZeros] diff --git a/src/tools/pgperlcritic/pgperlcritic b/src/tools/pgperlcritic/pgperlcritic new file mode 100755 index 00000000000..40d006bef6e --- /dev/null +++ b/src/tools/pgperlcritic/pgperlcritic @@ -0,0 +1,28 @@ +#!/bin/sh + +# src/tools/pgperlcritic/pgperlcritic + +test -f src/tools/pgperlcritic/perlcriticrc || { + echo could not find src/tools/pgperlcritic/perlcriticrc + exit 1 + } + +set -e + +# set this to override default perlcritic program: +PERLCRITIC=${PERLCRITIC:-perlcritic} + +# locate all Perl files in the tree +{ + # take all .pl and .pm files + find . -type f -a \( -name '*.pl' -o -name '*.pm' \) -print + # take executable files that file(1) thinks are perl files + find . -type f -perm -100 -exec file {} \; -print | + egrep -i ':.*perl[0-9]*\>' | + cut -d: -f1 +} | +sort -u | +xargs $PERLCRITIC \ + --quiet \ + --program-extensions .pl \ + --profile=src/tools/pgperlcritic/perlcriticrc