Skip to content

Commit af616ce

Browse files
committed
Add a script to detect perl compile time errors and warnings
Also add a function that centralizes the logic for locating all our perl files and use it in pgperlcritic and pgperltidy as well as the new pgperlcheck.
1 parent be3d900 commit af616ce

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

src/tools/perlcheck/find_perl_files

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
# src/tools/perlcheck/find_perl_files
3+
4+
# shell function to find all perl files in the source tree
5+
6+
find_perl_files () {
7+
{
8+
# take all .pl and .pm files
9+
find . -type f -name '*.p[lm]' -print
10+
# take executable files that file(1) thinks are perl files
11+
find . -type f -perm -100 -exec file {} \; -print |
12+
egrep -i ':.*perl[0-9]*\>' |
13+
cut -d: -f1
14+
} | sort -u
15+
}

src/tools/perlcheck/pgperlsyncheck

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
# script to detect compile time errors and warnings in all perl files
4+
5+
INCLUDES="-I src/tools/msvc -I src/tools/msvc/dummylib -I src/backend/catalog"
6+
INCLUDES="-I src/test/perl -I src/backend/utils/mb/Unicode $INCLUDES"
7+
INCLUDES="-I src/bin/pg_rewind -I src/test/ssl $INCLUDES"
8+
9+
set -e
10+
11+
. src/tools/perlcheck/find_perl_files
12+
13+
# for zsh
14+
setopt shwordsplit 2>/dev/null || true
15+
16+
find_perl_files | xargs -L 1 perl $INCLUDES -cw 2>&1 | grep -v OK

src/tools/pgindent/pgperltidy

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ set -e
77
# set this to override default perltidy program:
88
PERLTIDY=${PERLTIDY:-perltidy}
99

10-
# locate all Perl files in the tree
11-
(
12-
# take all .pl and .pm files
13-
find . -type f -a \( -name '*.pl' -o -name '*.pm' \)
14-
# take executable files that file(1) thinks are perl files
15-
find . -type f -perm -100 -exec file {} \; |
16-
egrep -i ':.*perl[0-9]*\>' |
17-
cut -d: -f1
18-
) |
19-
sort -u |
20-
xargs $PERLTIDY --profile=src/tools/pgindent/perltidyrc
10+
. src/tools/perlcheck/find_perl_files
11+
12+
find_perl_files | xargs $PERLTIDY --profile=src/tools/pgindent/perltidyrc

src/tools/pgperlcritic/pgperlcritic

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,9 @@ set -e
1212
# set this to override default perlcritic program:
1313
PERLCRITIC=${PERLCRITIC:-perlcritic}
1414

15-
# locate all Perl files in the tree
16-
{
17-
# take all .pl and .pm files
18-
find . -type f -name '*.p[lm]' -print
19-
# take executable files that file(1) thinks are perl files
20-
find . -type f -perm -100 -exec file {} \; -print |
21-
egrep -i ':.*perl[0-9]*\>' |
22-
cut -d: -f1
23-
} |
24-
sort -u |
25-
xargs $PERLCRITIC \
15+
. src/tools/perlcheck/find_perl_files
16+
17+
find_perl_files | xargs $PERLCRITIC \
2618
--quiet \
2719
--program-extensions .pl \
2820
--profile=src/tools/pgperlcritic/perlcriticrc

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy