Skip to content

Commit 914c770

Browse files
committed
Update readme
1 parent ce7fcfb commit 914c770

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

2-
Gitlab Report for PHP_CodeSniffer
2+
GitLab Report for PHP_CodeSniffer
33
---------------------------------
44
![Main workflow](https://github.com/micheh/phpcs-gitlab/workflows/Main%20workflow/badge.svg)
55
[![codecov](https://codecov.io/gh/micheh/phpcs-gitlab/branch/master/graph/badge.svg)](https://codecov.io/gh/micheh/phpcs-gitlab)
66

77

8-
This library adds a custom report to [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) (phpcs) to generate a codequality artifact, which can be used by Gitlab CI/CD.
9-
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.
8+
This library adds a custom report to [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/) (phpcs) to generate a codequality artifact that can be used by GitLab CI/CD.
9+
The custom report is generated in Code Climate format and allows GitLab CI/CD to display the violations in the Code Quality report.
1010

1111
## Installation
1212

@@ -16,7 +16,7 @@ Install this library using [Composer](https://getcomposer.org):
1616
composer require --dev micheh/phpcs-gitlab
1717
```
1818

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

2121
```yaml
2222
phpcs:
@@ -26,19 +26,25 @@ phpcs:
2626
codequality: phpcs-quality-report.json
2727
```
2828
29-
The example above uses two reports, one to display in the build log (full) and one to generate the codequality artifact file in the Code Climate format.
29+
The example above uses two reports, one to display in the build log (full) and one to generate the codequality artifact file in Code Climate format.
3030
31-
> **Note:** Gitlab currently does not support multiple codequality artifacts.
32-
> You will not be able to display the violations of multiple tools (e.g. PHP Code Sniffer & PHPStan) in the Code Quality report.
31+
> **Note:** GitLab did not support multiple codequality artifacts before version 15.7.
32+
> If you are using an earlier version of GitLab, you will not be able to see the violations from multiple tools (e.g. PHP Code Sniffer & PHPStan) in the Code Quality report.
3333
34-
Inside the codequality artifact, Gitlab expects relative paths to the files with violations.
35-
To generate relative paths with PHP Code Sniffer, set the `basepath` argument in your `phpcs.xml.dist` configuration file with `<arg name="basepath" value="."/>` or run phpcs with `--basepath=.` (adjust the base path as necessary).
34+
Inside the codequality artifact, GitLab expects relative paths to the files with violations.
35+
To generate relative paths with PHP Code Sniffer, set the `basepath` argument in your `phpcs.xml.dist` configuration file with `<arg name="basepath" value="."/>` or run phpcs with `--basepath=.` (adjust the base path as needed).
3636

37+
It is also possible to specify the reports to be used in the `phpcs.xml.dist` file:
38+
39+
```xml
40+
<arg name="report" value="full"/>
41+
<arg name="report-\Micheh\PhpCodeSniffer\Report\Gitlab" value="phpcs-quality-report.json"/>
42+
```
3743

3844
## References
3945

40-
- [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
41-
- [Gitlab CI/CD Code Quality](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html)
46+
- [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/)
47+
- [GitLab CI/CD Code Quality](https://docs.gitlab.com/ee/ci/testing/code_quality.html)
4248
- [Code Climate Specification](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types)
4349

4450

0 commit comments

Comments
 (0)