Download the PHP package jbzoo/ci-report-converter without Composer
On this page you can find all versions of the php package jbzoo/ci-report-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jbzoo/ci-report-converter
More information about jbzoo/ci-report-converter
Files in jbzoo/ci-report-converter
Package ci-report-converter
Short Description The tool converts different error reporting standards for deep integration with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc)
License MIT
Informations about the package ci-report-converter
JBZoo / CI-Report-Converter
- Why?
- Installing
- Using as GitHub Action
- Example GitHub Action workflow
- Available Directions
- Help description in terminal
- Converting
- Custom Metrics in TeamCity
- Examples
- JetBrains IDE (IntelliJ IDEA, PhpStorm, WebStorm, etc)
- Mess Detector (phpmd-json)
- Magic Number Detector (phpmnd)
- Copy/Paste Detector (pmd-cpd)
- PHPStan (checkstyle)
- Psalm (psalm-json)
- Phan (checkstyle)
- TeamCity - Style Issue As Failed Unit test
- TeamCity - Style Issue As Code Inspections
- TeamCity - Reported Statistic Values
- GitHub Actions
- GitLab CI
- Use tool as SDK to generate reports
- JUnit.xml (API)
- GitHub Actions (API)
- JetBrains IDE (IntelliJ IDEA, PhpStorm, WebStorm, etc)
- Contributing
- License
- See Also
Why?
I believe you are familiar with the huge zoo of various utilities for testing, checking code standards, linters etc.
It's really often the output of utilities is not supported in popular CI systems (TeamCity, GitHub, etc...).
I guess you are lucky if the utility saves the error report in the junit.xml
format, because it works pretty fine with almost all modern dev software.
But... My experience tells me it's the exception rather than the rule. For example, I really like the good old phpmd utility (perhaps you have another right opinion about the benefits. At least, it's just an example). It doesn't integrate well with TeamCity/PhpStorm/GitHub. Everytime I spend a lot of time looking for results in the logs. Though I really want to see instant and well-printed error report.
Therefore, I developed a converter that changes the report format for deep integration with CI systems and JetBrain IDEs.
Well... It may seem to you it's a useless thing, and your favorite super tool works fine in TeamCity/PhpStorm. Just take a look at the examples below.
Installing
Using as GitHub Action
Action allows you to convert error reports to the GitHub Annotations format
- See demo of error output
- To learn more see different examples
Example GitHub Action workflow
Available Directions
At the moment, converting of reports works with
- Input Formats:
- PHPcs and others.
- junit - also it's really popular sort of error report. Usually, the format is used to display unit test results.
- PHPMD.
- PHP Magic Numbers Detector.
- Psalm.
- Copy/Paste Detector.
- Output Formats:
- GitLab Custom Report.
- junit - The most popular sort of reporting.
- Reporting Tests in TeamCity/PhpStorm/JetBrains.
- Reporting Inspections in TeamCity.
Also, you can follow metrics around your code in TeamCity via teamcity:stats
- Example in TeamCity
- Example in TeamCity
- Example in TeamCity
- Example in TeamCity
- Example in TeamCity
Help description in terminal
Converting
Custom Metrics in TeamCity
To clarify the use of the method, take a look at the examples and screenshots below, please.
Examples
JetBrains IDE (IntelliJ IDEA, PhpStorm, WebStorm, etc)
One of the unique features of the tool is converting reports to a unit test format compatible with JetBrains IDE and TeamCity. The following examples show how to use JetBrains IDE UI to display any kind of style issues. Yeah, I know that the integration is not the cleanest, and it's not super beautiful. However, this code/screenshots demonstrate the usability of the approach.
NOTE: I believe that coding style issues have the same level of severity as any other sort of errors. Therefore, I prefer to use the same workflow to check the quality of the code as I do with regular PHPUnit tests. It's like "just one click!" Also, you will have the awesome bonus - navigating the project and gives the most detailed information about errors.
The general idea is pretty simple:
- We take almost any utility for testing.
- It saves report in the file or outputs error to StdOut as xml/json.
- CI-Report-Converter changes the report format. It saves result somewhere or just outputs it in StdOut.
- ???
- Profit.
In the next example we will see how to integrate JetBrains IDE UI with Code Sniffer deeply. I use PHPcs just as example. This is the most popular linter in PHP. However, the approach is independent of the programming language or unit testing framework.
What happens under the hood. Also, see source file as ready-to-use examples.
Mess Detector (phpmd-json)
Screenshot
![PHPmd in JetBrains PhpStorm](.github/assets/phpstorm-phpmd.png)Magic Number Detector (phpmnd)
Screenshot
![PHPmd in JetBrains PhpStorm](.github/assets/phpstorm-phpmnd.png)Copy/Paste Detector (pmd-cpd)
Screenshot
![PHPcpd in JetBrains PhpStorm](.github/assets/phpstorm-phpcpd.png)PHPStan (checkstyle)
Screenshot
![PHPstan in JetBrains PhpStorm](.github/assets/phpstorm-phpstan.png)Psalm (psalm-json)
Screenshot
![PHP Psalm in JetBrains PhpStorm](.github/assets/phpstorm-psalm.png)Phan (checkstyle)
Screenshot
![PHP Psalm in JetBrains PhpStorm](.github/assets/phpstorm-phan.png)TeamCity - Style Issue As Failed Unit test
Use the option --output-format=tc-tests
to convert any style report to unit test format in TeamCity
TeamCity - Style Issue As Code Inspections
Use the option --output-format=tc-inspections
to convert any style report to unit test format in TeamCity
TeamCity - Reported Statistic Values
Example in TeamCity
Example in TeamCity
Example in TeamCity
Example in TeamCity
shell ./vendor/bin/phpmetrics ./src --report-violations="./build/phpmetrics-report.xml" ./ci-report-converter.phar teamcity:stats --input-format="phpmetrics-xml" --input-file="./build/phpmetrics-report.xml"
GitHub Actions
You can find a lot of life examples here and see real examples in YML file
GitLab CI
Use the option --output-format=gitlab-json
to convert the report to Gitlab JSON format.
Als, see how to implemente GitLab Custom Report
Use tool as SDK to generate reports
Also, you can use source of tool as SDK for reports in your tools/project.
PS: More examples are coming soon.
JUnit.xml (API)
GitHub Actions (API)
Contributing
License
MIT
See Also
- Composer-Diff - See what packages have changed after
composer update
. - Composer-Graph - Dependency graph visualization of composer.json based on mermaid-js.
- Mermaid-PHP - Generate diagrams and flowcharts with the help of the mermaid script language.
- Utils - Collection of useful PHP functions, mini-classes, and snippets for every day.
- Image - Package provides object-oriented way to manipulate with images as simple as possible.
- Data - Extended implementation of ArrayObject. Use files as config/array.
- Retry - Tiny PHP library providing retry/backoff functionality with multiple backoff strategies and jitter support.
- SimpleTypes - Converting any values and measures - money, weight, exchange rates, length, ...
All versions of ci-report-converter with dependencies
ext-dom Version *
ext-simplexml Version *
ext-hash Version *
jbzoo/data Version ^7.1
jbzoo/utils Version ^7.1
jbzoo/cli Version ^7.1.8
jbzoo/markdown Version ^7.0
symfony/console Version >=6.4