Select Git revision
static-analysis.yml
-
Bartek Jaskulski authored
Signed-off-by:
Bart Jaskulski <bjaskulski@protonmail.com>
Bartek Jaskulski authoredSigned-off-by:
Bart Jaskulski <bjaskulski@protonmail.com>
static-analysis.yml 1.32 KiB
.static-analysis:
image: gitlab.wpdesk.dev:5050/wpdesk/docker-tests/php-box:8.2
needs:
- prepare prefixed vendor
stage: tests
# 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:
extends: .static-analysis
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 handle custom exit after removing rules.allow_failure part
exit 125
fi
allow_failure: true
rules:
- !reference [.skip-mr, rules]
- exists:
- phpstan.neon.dist
- exists:
- .phpstan-baseline.php
- .phpstan-baseline.neon
allow_failure: false
phpcs:
extends: .static-analysis
script:
- vendor/bin/phpcs
allow_failure: true
rules:
- !reference [.skip-mr, rules]
- exists:
- phpcs.xml.dist