manicmaniac / danger-periphery

A Danger plugin to detect unused codes using Periphery.
https://www.rubydoc.info/gems/danger-periphery/
MIT License
25 stars 7 forks source link

No Logs Displayed in Console from Periphery #241

Open Xopoko opened 3 months ago

Xopoko commented 3 months ago

I'm running Periphery using the following Dangerfile script:

# Run Periphery
puts "Running Periphery..."
periphery.scan(config: '.periphery.yml', project: 'MyProject.xcworkspace')
puts "Periphery run completed."

In the CI console, I only see:

Running Periphery...
Periphery run completed.

It seems that no logs from Periphery itself are being shown. Is there a way to make the utility output everything it prints to the console?

Alternatively, is it possible to run Periphery separately and feed its JSON output to danger-periphery instead?

manicmaniac commented 3 months ago

As you mentioned, the feature is not implemented. I understand the need but still wondering how to implement it.

The point is that danger-periphery blocks IO while it is running because it uses Open3.capture3 internally. However, I think that console log should be implemented in smarter way, like non-blocking IO that is constantly written while running Periphery.

Using other methods like Kernel#spawn may solve this problem. I'll try it later (and I'm welcome PRs as well).

  1. Is there a way to make the utility output everything it prints to the console?

  2. is it possible to run Periphery separately and feed its JSON output to danger-periphery instead?

Although both ways sound good to me, 2 would be simpler considering the above blocking problem 🤔