-
Notifications
You must be signed in to change notification settings - Fork 6
How to install and setup our code quality converter
Tom de Wit edited this page Feb 9, 2021
·
3 revisions
https://github.com/beechit/json-to-code-climate-subset-converter
composer require beechit/json-to-code-climate-subset-converter --dev
./vendor/bin/converter convert
We run the converter from the project root, without any tools enabled. Each tool has their own respective flags:
./vendor/bin/converter convert --phpstan
./vendor/bin/converter convert --psalm
./vendor/bin/converter convert --phan
./vendor/bin/converter convert --phpcs
./vendor/bin/converter convert --phplint
./vendor/bin/converter convert --php-cs-fixer
Each tool also has their respective flags for their JSON input files:
./vendor/bin/converter convert --phpstan --phpstan-json-file=path/to/file.json
./vendor/bin/converter convert --psalm --psalm-json-file=path/to/file.json
./vendor/bin/converter convert --phan --phan-json-file=path/to/file.json
./vendor/bin/converter convert --phpcs --phpcs-json-file=path/to/file.json
./vendor/bin/converter convert --phplint --phplint-json-file=path/to/file.json
./vendor/bin/converter convert --php-cs-fixer --php-cs-fixer-json-file=path/to/file.json
In the following example all supported tools are included.
CodeQuality:
stage: Code quality converter
dependencies:
- Build project
- PHPLint
- PHPStan
- Psalm
- PHP_CodeSniffer
- Phan
- PHP-CS-Fixer
script:
- ./vendor/bin/converter convert --phplint --phplint-json-file=phplint.json --psalm --psalm-json-file=psalm.json --phpstan --phpstan-json-file=phpstan.json --php_codesniffer --php_codesniffer-json-file=phpcs.json --phan --phan-json-file=phan.json --php-cs-fixer --php-cs-fixer-json-file=php-cs-fixer.json
artifacts:
reports:
codequality: code-climate.json
when: always
Earlier in the configuration file you've defined the "Code quality converter" stage. Within GitLab's artifacts now comes a special key reports
. Within we define a codequality
key and use the tool's default file code-climate.json
. Since GitLab, by default, doesn't store it's artifacts on failure, we overrule it's setting by always uploading code-climate.json
.