diff --git a/core/phpstan-partial.neon b/core/phpstan-partial.neon index 8d78ca825f7d8aed4fc20feb1802e9323f3477b5..9310c6e291a5dab29262cff381b4fe0f33b8123c 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 2d434fa7201eb18eea07f4641c70b883ca752fe7..3563ed7c59fcce6bf48fe5806c76971b4a893bfb 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