This is an old revision of the document!
master
branch first. If no artifact exists on master Gitlab can't compare code quality
PHPStan
composer require --dev phpstan/phpstan
Add .gitlab-ci.yml
:
stages: - test code_quality: image: composer stage: test script: - composer install --no-ansi # Set output to 'gitlab' using '--error-format=gitlab', 'exit 0' is required and the artifact gets uploaded - ./vendor/bin/phpstan analyse --error-format=gitlab --no-progress Classes/ > gl-code-quality-report.json || exit 0 artifacts: reports: # Tell Gitlab about the custom generated reports JSON file codequality: gl-code-quality-report.json paths: [gl-code-quality-report.json]
./vendor/bin/phpstan analyse | –error-format=gitlab | –no-progress | Classes/ | > gl-code-quality-report.json | exit 0 |
---|---|---|---|---|---|
Run analyzer | Output Gitlab readable JSON format | Hide progress indicator | Folders to analyze | Write output to file | Make sure job always passes |