From 7c0268d55c4d28c8da80264820d1a8cbf0528a45 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 8 Mar 2025 09:26:46 -0500 Subject: [PATCH] Display summary of warnings --- tests/display_warnings.inc.sh | 11 +++++++++++ tests/run.sh | 2 ++ tests/run_coding_standards_check.sh | 1 + tests/run_static_analysis_check_phpstan.sh | 1 + tests/run_static_analysis_check_psalm.sh | 1 + 5 files changed, 16 insertions(+) create mode 100644 tests/display_warnings.inc.sh diff --git a/tests/display_warnings.inc.sh b/tests/display_warnings.inc.sh new file mode 100644 index 000000000..e145ca550 --- /dev/null +++ b/tests/display_warnings.inc.sh @@ -0,0 +1,11 @@ +warning_count="${#warnings[@]}" +if [[ "${warning_count}" -ge 1 ]]; then + echo -e "\nWarnings found: ${warning_count}" + + iter=0 + for value in "${warnings[@]}"; do + ((iter++)) + echo -e "\nWarning ${iter} of ${warning_count}:" + echo "⚠️ ${value}" | perl -pe 's/^(.*)$/\t\1/' + done +fi diff --git a/tests/run.sh b/tests/run.sh index 9a72e4485..e0b843252 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -2,6 +2,7 @@ set -x +warnings=() errors=() if [[ "${CI}" == "true" ]]; then @@ -55,6 +56,7 @@ source "run_static_analysis_check_psalm.sh" set +x +source "display_warnings.inc.sh" source "display_errors.inc.sh" if [[ "${CI_PHP_FUTURE_RELEASE}" != "true" ]]; then diff --git a/tests/run_coding_standards_check.sh b/tests/run_coding_standards_check.sh index 8a6b83219..ccf99ef35 100755 --- a/tests/run_coding_standards_check.sh +++ b/tests/run_coding_standards_check.sh @@ -132,6 +132,7 @@ if [[ $(echo "${CI_PHP_VERSION} < 8.4" | bc -l) -eq 1 ]]; then fi else echo "⚠️ Skipped running PHP-CS-Fixer coding standards check" + warnings+=("Skipped running PHP-CS-Fixer coding standards check") fi popd diff --git a/tests/run_static_analysis_check_phpstan.sh b/tests/run_static_analysis_check_phpstan.sh index d52ba1783..fbb6b6ba0 100755 --- a/tests/run_static_analysis_check_phpstan.sh +++ b/tests/run_static_analysis_check_phpstan.sh @@ -27,6 +27,7 @@ if [[ $(echo "${CI_PHP_VERSION} >= 7.4" | bc -l) -eq 1 ]]; then fi else echo "⚠️ Skipped running phpstan check" + warnings+=("Skipped running phpstan check") fi popd diff --git a/tests/run_static_analysis_check_psalm.sh b/tests/run_static_analysis_check_psalm.sh index 2c5b6e259..eb5870f2f 100755 --- a/tests/run_static_analysis_check_psalm.sh +++ b/tests/run_static_analysis_check_psalm.sh @@ -12,6 +12,7 @@ set -x if [[ ! -f "vendor/bin/psalm" ]]; then echo "⚠️ Skipped running psalm static analysis check" + warnings+=("Skipped running psalm static analysis check") else vendor/bin/psalm --version