File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 18
18
TEST_NAME=$( sed -n ' 3s/ \* //p' " $TEST_FILE " )
19
19
20
20
echo " "
21
- echo " Running test: $TEST_NAME with ruleset: $RULESET "
21
+ echo " Running test: ${ TEST_NAME} with ruleset: $RULESET "
22
22
echo " $TEST_FILE "
23
23
24
24
# Use --basepath=. to ensure relative paths in the report.
25
25
JSON_REPORT=$( phpcs --standard=" ./$RULESET /ruleset.xml" --report=json --basepath=. " $TEST_FILE " 2> /dev/null | sed -n ' /{/,$p' )
26
26
27
27
# Debug
28
- # echo "JSON Report:"
29
- # echo "$JSON_REPORT"
28
+ # echo "JSON Report: ${JSON_REPORT}"
30
29
31
- # Extract actual and expected errors.
32
- ACTUAL_OUTPUT=$( echo " $JSON_REPORT " | jq -r ' .files."' " $TEST_FILE " ' ".messages[]?. source' | sort)
33
- EXPECTED_OUTPUT=$( (sed -n " s/.*@expectedError\[$RULESET \] //p" " $TEST_FILE " ; sed -n " s/.*@expectedWarning\[$RULESET \] //p" " $TEST_FILE " ) | sort)
30
+ # Extract actual and expected errors, including severity .
31
+ ACTUAL_OUTPUT=$( echo " $JSON_REPORT " | jq -r ' .files."' " $TEST_FILE " ' ".messages[] | "[\(.type | ascii_upcase)] \(. source)" ' | sort)
32
+ EXPECTED_OUTPUT=$( (sed -n " s/.*@expectedError\[$RULESET \] /\[ERROR\] /p" " $TEST_FILE " ; sed -n " s/.*@expectedWarning\[$RULESET \] /\[WARNING\] /p" " $TEST_FILE " ) | sort)
34
33
35
34
echo " --------------------------------------------------"
36
35
echo " EXPECTED ISSUES:"
You can’t perform that action at this time.
0 commit comments