xcbeautify icon indicating copy to clipboard operation
xcbeautify copied to clipboard

Formatting to JSON

Open AvdLee opened this issue 6 years ago • 1 comments

Hey there!

First of all, this project really seems promising. I've been using XCPretty for quite a while and I would love to replace it with a more up to date framework that is also more performant.

However, before I jump on that boat, I'd like to find out whether I can get to the same results as I want. We're currently using https://github.com/marcelofabri/xcpretty-json-formatter so we can use https://github.com/f-meloni/danger-swift-xcodesummary.

Is there any way to get to the same JSON result with xcbeautify? It allows us to parse the warnings, errors, and messages, to show them in Pull Requests.

Thanks!

AvdLee avatar Jan 23 '20 10:01 AvdLee

Hey 👋

It’s current not possible to output to JSON format, and the current implementation might require a bit of refactoring in order to make the output extensible.

thii avatar Feb 01 '20 02:02 thii

Hey @AvdLee! I'm working on some changes (see here: https://github.com/tuist/xcbeautify/pull/107) to introduce GitHub Actions support. My draft PR proposes a refactor where there'd be different OutputRendering types. So, the current implementation would change to a TerminalRenderer and then I'm adding another one called GitHubActionsRenderer. This new renderer would support inline feedback around warnings, errors, and messages, but it'd obviously be limited to PRs using GitHub Actions.

For your use case, I think it'd make more sense to build something similar to the JUnitReporter. However, this is making me question if it'd make sense to consolidate these different reporters and renderers, since it's likely that a consumer only cares about only one of the different options.

Are you using GitHub Actions? If so, I think you might be able to skip the need for JSON reporting altogether and use the renderer that I'm proposing. I have a similar setup and use case.

@AvdLee @pepicrft @thii Thoughts?

cpisciotta avatar Jun 24 '23 15:06 cpisciotta

@cpisciotta the approach you are suggesting sounds reasonable from y end.

pepicrft avatar Jun 26 '23 08:06 pepicrft

@cpisciotta we're using Bitrise in combination with Danger, so we're still in need of a JSON output. However, we moved away from Xcode Summary, so there's no need for this issue from my perspective anymore. Feel free to close.

AvdLee avatar Jul 05 '23 12:07 AvdLee

@AvdLee Got it- thanks for the update!

cpisciotta avatar Jul 06 '23 22:07 cpisciotta