Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,28 @@ runs:
# our configuration for this extension, and if we used that command it
# wouldn't autoload PHPUnitTestTrait properly. Potential cause:
# https://github.com/squizlabs/PHP_CodeSniffer/issues/1463
run: vendor/bin/phpcs -sp --standard=.phpcs.xml .
shell: bash
run: |
vendor/bin/phpcs --report=json --standard=.phpcs.xml . > phpcs-report.json

if [ -s phpcs-report.json ]; then
jq -c 'to_entries[] | {file: .key, messages: .value.messages}' phpcs-report.json | while read -r entry; do
FILE=$(echo "$entry" | jq -r '.file')
MESSAGES=$(echo "$entry" | jq '.messages')

if [ "$MESSAGES" != "null" ]; then
echo "$MESSAGES" | jq -c '.[]' | while read -r msg; do
LINE=$(echo "$msg" | jq -r '.line')
COL=$(echo "$msg" | jq -r '.column')
TYPE=$(echo "$msg" | jq -r '.type')
MESSAGE=$(echo "$msg" | jq -r '.message')

LEVEL="notice"
[ "$TYPE" = "ERROR" ] && LEVEL="error"
[ "$TYPE" = "WARNING" ] && LEVEL="warning"

echo "::${LEVEL} file=${FILE},line=${LINE},col=${COL}::${MESSAGE}"
done
fi
done
fi
shell: bash