From 6a27d7621519853a115b49f7745d7679bf172cd1 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Wed, 18 May 2022 09:02:22 +0100 Subject: [PATCH] Issue #3259355 by mallezie, mondrake, catch, longwave, mglaman, alexpott, xjm, daffie, Mixologic: Always do a full phpstan analysis on DrupalCI --- core/phpstan-partial.neon | 4 ++-- core/scripts/dev/commit-code-check.sh | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/phpstan-partial.neon b/core/phpstan-partial.neon index 8d78ca825f7d..9310c6e291a5 100644 --- a/core/phpstan-partial.neon +++ b/core/phpstan-partial.neon @@ -1,5 +1,5 @@ # Configuration file for PHPStan static code checking, see https://phpstan.org . -# PHPStan is triggered on Drupal CI in commit-code-check.sh. +# PHPStan with partial analysis is triggered in commit-code-check.sh. includes: - phpstan.neon.dist @@ -7,4 +7,4 @@ includes: # only to allow core/scripts/dev/commit-code-check.sh to run against a subset of # the codebase. parameters: - reportUnmatchedIgnoredErrors: false + reportUnmatchedIgnoredErrors: false \ No newline at end of file diff --git a/core/scripts/dev/commit-code-check.sh b/core/scripts/dev/commit-code-check.sh index 2d434fa7201e..3563ed7c59fc 100755 --- a/core/scripts/dev/commit-code-check.sh +++ b/core/scripts/dev/commit-code-check.sh @@ -216,15 +216,17 @@ printf -- '-%.0s' {1..100} printf "\n" -# Run PHPStan on all files in one go for better performance. APCu is disabled to -# ensure that the composer classmap is not corrupted. -if [[ $PHPSTAN_DIST_FILE_CHANGED == "1" ]]; then +# Run PHPStan on all files on DrupalCI or when phpstan files are changed. +# APCu is disabled to ensure that the composer classmap is not corrupted. +if [[ $PHPSTAN_DIST_FILE_CHANGED == "1" ]] || [[ "$DRUPALCI" == "1" ]]; then printf "\nRunning PHPStan on *all* files.\n" php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --no-progress --configuration="$TOP_LEVEL/core/phpstan.neon.dist" else + # Only run PHPStan on changed files locally. printf "\nRunning PHPStan on changed files.\n" php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --no-progress --configuration="$TOP_LEVEL/core/phpstan-partial.neon" $ABS_FILES fi + if [ "$?" -ne "0" ]; then # If there are failures set the status to a number other than 0. FINAL_STATUS=1 -- GitLab