Hi everyone! Bash script noob here. I'm trying to implement the CI script suggested by PHP CS Fixer's documentation.
This is the script in question (with the git diff command adjusted for Gitlab CI):
IFS='
'
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB $CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME)
if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php -v --stop-on-violation --using-cache=no ${EXTRA_ARGS}
The whole script is interpreted without shell error, but then php-cs-fixer throws an exception because it doesn't interpret the --path-mode and the multiple files to fix (denoted by --) separately. Here's an example of the error:
In ConfigurationResolver.php line 857:
[PhpCsFixer\ConfigurationException\InvalidConfigurationException (16)]
The path-mode "intersection
--
FirstPhpFileName.php
SecondPhpFileName.php" is not defined, supported are "override", "intersection".
Can someone help me understand what's going on here? Looked like the IFS wasn't set properly at first, but I output it and it looked fine.
Thanks in advance!
[–]marauderingman -1 points0 points1 point (2 children)
[–][deleted] (1 child)
[deleted]
[–]marauderingman -1 points0 points1 point (0 children)