File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,29 @@ STATUS=0
6262
6363
6464
65+ # Ensure that PHPCS command is available
66+ PHPCS_COMMAND=" "
67+ PHPCBF_COMMAND=" "
68+ if [ -f " ${MATOMO_DIR} /vendor/bin/phpcs" ]; then
69+ PHPCS_COMMAND=" ${MATOMO_DIR} /vendor/bin/phpcs"
70+ PHPCBF_COMMAND=" ${MATOMO_DIR} /vendor/bin/phpcbf ${REPO_DIR} --standard=${REPO_DIR} /phpcs.xml"
71+ fi
72+ # If no command, exit
73+ if [[ -z " PHPCS_COMMAND" ]]; then
74+ echo " No way to run phpcs found."
75+ exit 1
76+ fi
77+
78+ echo " Running PHPCS on repo: ${PHPCS_COMMAND} --report-full --standard=${REPO_DIR} /phpcs.xml ${REPO_DIR} "
79+ if ! $PHPCS_COMMAND --report-full --standard=${REPO_DIR} /phpcs.xml ${REPO_DIR} ; then
80+ echo " There was an issue found during the PHPCS check."
81+ echo " You might try running PHPCBF to automatically fix issues before manually fixing them: ${PHPCBF_COMMAND} "
82+ echo " "
83+ STATUS=1
84+ fi
85+
86+
87+
6588# ## Run PHPStan on newly created files. ###
6689
6790PHPSTAN_CREATED_CONFIG=phpstan/phpstan.created.neon
You can’t perform that action at this time.
0 commit comments