-
Notifications
You must be signed in to change notification settings - Fork 6
How to install and setup Psalm
Tom de Wit edited this page Dec 11, 2020
·
2 revisions
https://psalm.dev or https://github.com/vimeo/psalm
composer require vimeo/psalm --dev
After installation, Psalm needs to be initialised. Refer to their documentation for full examples.
./vendor/bin/psalm --init
./vendor/bin/psalm --report=psalm.json
We run Psalm from the project root but define project files within the psalm.xml
file. We output the result to a JSON-file called psalm.json
.
Psalm:
stage: Code quality
allow_failure: true
script:
- ./vendor/bin/psalm --report=psalm.json
artifacts:
paths:
- psalm.json
when: always
Earlier in the configuration file you've defined the "Code quality" stage. Since quality assurance tools can fail we allow this job to fail to signal there are Psalm errors. We then run the aforementioned script and save the output. Since GitLab, by default, doesn't store it's artifacts on failure, we overrule it's setting by always uploading psalm.json
.