Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
feat(formatter): Add support for multiple formatters and class formatters #357
This PR adds support for passing multiple formatters by using the following syntax
php phpinsights analyse --format=json --format=github-action
It also allows to reference a formatter by class, as long as it is loaded.
php phpinsights analyse -n -format=\\NunoMaduro\\PhpInsights\\Application\\Console\\Formatters\\Json
This means you can now create a custom formatter to use, to integrate with your own custom system if needed.
@olivernybroe Look good to me
One last question: What's happen when we call phpinsights like this
vendor/bin/phpinsights --format=test --format=test2 --format=console
As test and test2 are not formatters, the fallback will use console.
So the output will be displayed 3 times ?
Maybe we should do something in Multiple formatter to remove duplicated formatter ?
@Jibbarth Forgot to answer your previous question also
So output by format is simply something I haven't added in. I think it is something worth considering, however for us to do that, we need to add proper support for exporting to file instead of piping the results. I think that should be in another PR.
Regarding multiple invalid formatters, then yes, it will actually result in the console formatter being used multiple times. I'll look into that one, as that is just plain stupid