Select Git revision
TestFormCollection.php
static-analysis.yml 1.23 KiB
.static-analysis: &static-tmpl
image: gitlab.wpdesk.dev:5050/wpdesk/docker-tests/php-box:8.2
needs:
- prepare prefixed vendor
stage: tests
extends: .skip-mr
# Run phpstan in strict mode (failing pipeline) only if we have baseline, otherwise allow to fail with a warning, suggesting to create one. This behavior will change at the end of the year, when any PHPStan failure will be considered fatal
phpstan:
<<: *static-tmpl
script:
- |
if [ -f "vendor/bin/phpstan" ]; then
vendor/bin/phpstan analyse --memory-limit=2G
elif [ -f "vendor/wpdesk/wp-wpdesk-composer/director/vendor/bin/phpstan" ]; then
# PHPStan installed by director
vendor/wpdesk/wp-wpdesk-composer/director/vendor/bin/phpstan analyse --memory-limit=2G
else
echo "PHPStan not found! Install it with 'composer require --dev wpdesk/phpstan-rules'."
# We will be able to use custom exit after removing rules.allow_failure part
# exit 125
fi
allow_failure: true
rules:
- exists:
- .phpstan-baseline.php
- .phpstan-baseline.neon
allow_failure: false
phpcs:
<<: *static-tmpl
script:
- vendor/bin/phpcs
allow_failure: true
rules:
- exists:
- phpcs.xml.dist