woocommerce/tests/bin/phpcs.sh

15 lines
512 B
Bash
Raw Normal View History

2017-10-09 20:31:15 +00:00
#!/usr/bin/env bash
COMMIT_RANGE="${1}...${2}"
CHANGED_FILES=`git diff --name-only --diff-filter=ACMR $COMMIT_RANGE | grep \\\\.php | awk '{print}' ORS=' '`
IGNORE="tests/cli/,includes/libraries/,includes/api/legacy/"
2017-10-09 20:31:15 +00:00
if [ "$CHANGED_FILES" != "" ]; then
2021-03-14 00:06:06 +00:00
echo "Changed files: $CHANGED_FILES"
echo "Running Code Sniffer."
2021-03-14 00:06:06 +00:00
./vendor/bin/phpcs --ignore=$IGNORE --encoding=utf-8 -s -n -p --report-full --report-checkstyle=./phpcs-report.xml ${CHANGED_FILES}
2021-03-14 00:06:06 +00:00
else
echo "No changes found. Skipping PHPCS run."
2017-10-10 12:34:47 +00:00
fi