PhpMetrics icon indicating copy to clipboard operation
PhpMetrics copied to clipboard

Exit code on violations in vendor binary

Open gisostallenberg opened this issue 3 years ago • 0 comments

Feature request

Currently the vendor binary returns nothing, which makes it hard to integrate in any CI without the CI understanding PMD files.

I suggest to make Hal\Application\Application::run return the status (also where it has exit at the moment) and finally return either 0 (no violations) or 4 (violations). Then have bin/phpmetrics exit with the return value of that call. The 4 exit status comes from https://pmd.github.io/latest/pmd_userdocs_cli_reference.html#exit-status Because this might not be BC when Hal\Application\Application::run is used in other applications (although I cannot imagine them relying on exit) this behavior can also be added using an option --report-status and only add the exit in bin/phpmetrics for non null results.

I'm happy to provide a PR.

gisostallenberg avatar Jun 23 '21 12:06 gisostallenberg