-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·38 lines (30 loc) · 778 Bytes
/
run-tests.sh
File metadata and controls
executable file
·38 lines (30 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
for CMD in "php" "phpcs" "shellcheck"; do
if ! command -v "${CMD}" > /dev/null 2>&1; then
echo "Error: Cannot find executable: ${CMD}"
exit 1
fi
done
ERRORS=0
cd "$(dirname "$0")" || exit 1
for FILE in $(find . -type f -and \( -name "*.php" -or -name "*.phtml" \) | sort); do
php -l "${FILE}"
rc=$?
if [ $rc != 0 ]; then
ERRORS=$((ERRORS + rc))
fi
phpcs --standard=PSR1,PSR2 --exclude="Generic.Files.LineLength" "${FILE}"
rc=$?
if [ $rc != 0 ]; then
ERRORS=$((ERRORS + rc))
fi
done
for FILE in $(find . -type f -and -name "*.sh" | sort); do
shellcheck "${FILE}"
rc=$?
if [ $rc != 0 ]; then
ERRORS=$((ERRORS + rc))
fi
done
cd "${OLDPWD}" || exit 1
exit "${ERRORS}"