This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Return the number of clones instead of exiting. #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I'd like to use phpcpd from within another application and in conjunction with other CI tools like phpcs, phpunit etc. being installed using Composer.
I use the following code:
which works fine except the fact that if clones are found phpcpd will
exit()so my application "dies"...So the idea here is to return the number of clones found (or zero) instead of hard exiting. I know this a a bit "unorthodox", but it works. The only limit here would be that only 255 clones will be displayed as this is the maximum error status, but well ;)
Another (and of course "cleaner") option would be to return
1, so the SymphonyApplication will exit with this status code (ifautoExitisn't set tofalse).BTW: here is a Travis log of our custom script invoking phpcs and phpunit using a similar technique described earlier: https://travis-ci.org/joomla/jissues/jobs/21904034
The scripts invoking those can be found here: https://github.com/joomla/jissues/tree/master/cli/Application/Command/Test
This is a Joomla! Application 😉