Name Last Update
..
.github Loading commit data...
src/Report Loading commit data...
tests Loading commit data...
.gitignore Loading commit data...
LICENSE.md Loading commit data...
README.md Loading commit data...
composer.json Loading commit data...
phpcs.xml.dist Loading commit data...
phpunit.xml.dist Loading commit data...
psalm.xml.dist Loading commit data...

Gitlab Report for PHP_CodeSniffer

Main workflow codecov

This library adds a custom report to PHP_CodeSniffer (phpcs) to generate a codequality artifact, which can be used by Gitlab CI/CD. The custom report will be generated in the Code Climate format and allows Gitlab CI/CD to display the violations in the Code Quality report.

Installation

Install this library using Composer:

```shell script composer require --dev micheh/phpcs-gitlab


Then adjust your `.gitlab-ci.yml` to run PHP_CodeSniffer with the custom reporter and to gather the codequality artifacts:

```yaml
phpcs:
  script: vendor/bin/phpcs --report=emacs --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-quality-report.json
  artifacts:
    reports:
      codequality: phpcs-quality-report.json

The example above uses two reports, one to display in the build log (emacs) and one to generate the codequality artifact file in the Code Climate format.

Note: Gitlab currently does not support multiple codequality artifacts. You will not be able to display the violations of multiple tools (e.g. PHP Code Sniffer & PHPStan) in the Code Quality report.

References

License

The files in this archive are licensed under the BSD-3-Clause license. You can find a copy of this license in LICENSE.md.