woshiccm / Pecker

CodePecker is a tool to detect unused Swift code.
MIT License
1.46k stars 63 forks source link

Fix running from Terminal #38

Closed rastersize closed 4 years ago

rastersize commented 4 years ago

Hi!

I was having the same issue as described in #33. I cloned the source and did some debugging and think I found the bug. So here’s a PR that should fix it. It at least ran for me, although it reported a count of 0 for a very large codebase that most likely have some unused code.

When running from the terminal Pecker would fail with a missingValue(argument: Optional("BUILD_ROOT")) error. Even when the -i CLI parameter was provided. This moves the fallback logic to only run when a fallback needs to be found.