Skip to content

Commit 3d03d25

Browse files
committed
Merge pull request php-curl-class#116 from zachborboa/master
Add line ending and indentation character consistency checks
2 parents b24f0e0 + c1cf3b3 commit 3d03d25

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/script.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@ find . -type "f" -iname "*.php" | xargs -L "1" php -l
44
# Run tests.
55
cd tests && phpunit --configuration phpunit.xml
66

7-
# Check for trailing whitespace in php files.
7+
# Enforce line ending consistency in php files.
8+
crlf_file=$(find . -type "f" -iname "*.php" -exec grep --files-with-matches $'\r' {} \;)
9+
if [[ ! -z "${crlf_file}" ]]; then
10+
echo "${crlf_file}" | perl -pe 's/(.*)/CRLF line terminators found in \1/'
11+
exit 1
12+
fi
13+
14+
# Enforce indentation character consistency in php files.
15+
tab_char=$(find . -type "f" -iname "*.php" -exec grep --line-number -H --perl-regexp "\t" {} \;)
16+
if [[ ! -z "${tab_char}" ]]; then
17+
echo -e "${tab_char}" | perl -pe 's/^(.*)$/Tab character found in \1/'
18+
exit 1
19+
fi
20+
21+
# Prohibit trailing whitespace in php files.
822
trailing_whitespace=$(find . -type "f" -iname "*.php" -exec egrep --line-number -H " +$" {} \;)
923
if [[ ! -z "${trailing_whitespace}" ]]; then
1024
echo -e "${trailing_whitespace}" | perl -pe 's/^(.*)$/Trailing whitespace found in \1/'

0 commit comments

Comments
 (0)