Unverified Commit 92a87eac authored by alexpott's avatar alexpott
Browse files

Issue #3224583 by daffie, dhirendra.mishra, longwave: The testbot does not run...

Issue #3224583 by daffie, dhirendra.mishra, longwave: The testbot does not run PHPCS on all files when core/phpcs.xml.dist is changed
parent 38c6162c
......@@ -107,10 +107,17 @@
TOP_LEVEL=$(git rev-parse --show-toplevel)
# This variable will be set to one when the file core/phpcs.xml.dist is changed.
PHPCS_XML_DIST_FILE_CHANGED=0
# Build up a list of absolute file names.
ABS_FILES=
for FILE in $FILES; do
ABS_FILES="$ABS_FILES $TOP_LEVEL/$FILE"
if [[ $FILE == "core/phpcs.xml.dist" ]]; then
PHPCS_XML_DIST_FILE_CHANGED=1;
fi;
done
# Exit early if there are no files.
......@@ -163,6 +170,20 @@
printf -- '-%.0s' {1..100}
printf "\n"
# When the file core/phpcs.xml.dist has been changed, then PHPCS must check all files.
if [[ $PHPCS_XML_DIST_FILE_CHANGED == "1" ]]; then
# Test all files with phpcs rules.
vendor/bin/phpcs -ps --runtime-set installed_paths "$TOP_LEVEL/vendor/drupal/coder/coder_sniffer" --standard="$TOP_LEVEL/core/phpcs.xml.dist"
PHPCS=$?
if [ "$PHPCS" -ne "0" ]; then
# If there are failures set the status to a number other than 0.
FINAL_STATUS=1
printf "\nPHPCS: ${red}failed${reset}\n"
else
printf "\nPHPCS: ${green}passed${reset}\n"
fi
fi
for FILE in $FILES; do
STATUS=0;
# Print a line to separate spellcheck output from per file output.
......@@ -199,7 +220,7 @@
############################################################################
### PHP AND YAML FILES
############################################################################
if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.(inc|install|module|php|profile|test|theme|yml)$ ]]; then
if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.(inc|install|module|php|profile|test|theme|yml)$ ]] && [[ $PHPCS_XML_DIST_FILE_CHANGED == "0" ]]; then
# Test files with phpcs rules.
vendor/bin/phpcs "$TOP_LEVEL/$FILE" --runtime-set installed_paths "$TOP_LEVEL/vendor/drupal/coder/coder_sniffer" --standard="$TOP_LEVEL/core/phpcs.xml.dist"
PHPCS=$?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment