woshiccm / Pecker

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

Could not see any warning in Xcode 11.3 #33

Open junaid4058 opened 4 years ago

junaid4058 commented 4 years ago

I can't see any warning what https://github.com/woshiccm/Pecker#pecker is showing. I did as below: https://github.com/woshiccm/Pecker#pecker

woshiccm commented 4 years ago

How do you install pecker? CocoPods?

hodovani commented 4 years ago

I have the same issue. I used brew.

woshiccm commented 4 years ago

I will improve log, maybe find index failed

woshiccm commented 4 years ago

@hodovani can you open the follow path? ~/Library/Developer/Xcode/DerivedData/{your project}/Index/DataStore

woshiccm commented 4 years ago

Have you ever execute defaults write com.apple.dt.Xcode IDEIndexDisable 1?

woshiccm commented 4 years ago

@junaid4058 @hodovani Add make sure you are using the right method If you Install through CocoaPods, add the following script

${PODS_ROOT}/Pecker/bin/pecker

Other way install, add the following script

if which pecker >/dev/null; then
  pecker
else
  echo "warning: Pecker not installed, download from https://github.com/woshiccm/Pecker"
fi
hodovani commented 4 years ago

@hodovani can you open the follow path? ~/Library/Developer/Xcode/DerivedData/{your project}/Index/DataStore

Yes, I can. I added your script to my main target as you described in Readme

hodovani commented 4 years ago

I tried to run it terminal in project folder, but it didn't give me any warn.

woshiccm commented 4 years ago

If you want run in terminal, pls do as follow pecker -i , and you need set report as json and set output_file in pecker.result.json, it's complex.

Suggest integrate Pecker into an Xcode, because this way will automatically found your project index path

woshiccm commented 4 years ago

@hodovani Could you show me a screenshot of the script you added to your project?

woshiccm commented 4 years ago

You can also connect me on Twitter, Twitter is more convenient for communication

rastersize commented 4 years ago

I had the same issue and think this PR should fix it: https://github.com/woshiccm/Pecker/pull/38

woshiccm commented 4 years ago

@rastersize Good job

woshiccm commented 4 years ago

@hodovani I had added Terminal usage to README, and I test successed, you can try again, the version is 0.0.12

kaushalyap commented 4 years ago

@woshiccm I am just curious, cannot Xcode detect unused code? Why we need Pecker? In Android Studio, IntelliJ IDEA they detect unused code.

woshiccm commented 4 years ago

@kaushalyap Xcode did, but only same case, such as variables defined in the function body, more often it is difficult to judge, so pecker have so many configurations to prevent judgment false.

kaushalyap commented 4 years ago

@kaushalyap Xcode did, but only same case, such as variables defined in the function body, more often it is difficult to judge, so pecker have so many configurations to prevent judgment false.

It seems to me that XCode is not doing a good job like Android Studio, IntelliJ IDEA.

gobetti commented 4 years ago

I'm on macOS 10.15.3, Xcode 11.4 Beta 3 and I don't see anything output on neither Xcode nor Terminal but that seems to be because of the SwiftSyntax error mentioned right at the beginning of the README file. Unfortunately pecker doesn't output any errors (per #19) so one thing I can suggest here to folks having no results is to prefix the pecker command with DYLD_PRINT_RPATHS=1, it made clear to me what's going on:

RPATH failed expanding     @rpath/lib_InternalSwiftSyntaxParser.dylib to: /usr/lib/swift/lib_InternalSwiftSyntaxParser.dylib
RPATH failed expanding     @rpath/lib_InternalSwiftSyntaxParser.dylib to: /usr/local/Cellar/pecker/0.1.0/bin/lib_InternalSwiftSyntaxParser.dylib

Before doing that, I've also tried to run the Pecker project straight from Xcode, which printed the lib_InternalSwiftSyntaxParser.dylib error to the console, but I don't know which build flags SPM uses when running from Xcode, the Makefile ones are explicit so I could try a couple different things there iterating on make installs and running with DYLD_PRINT_RPATHS=1. No solution yet, unfortunately.

By the way, SwiftLint is trying to solve the same issue on their repo, I'd suggest to follow their PR as they may find a solution any time soon: https://github.com/realm/SwiftLint/pull/3108

cpd commented 4 years ago

Any news?

macOS 10.15.4 Xcode 11.4 method: brew

Stops right after run, with no output

Edit: was fine 1 month ago, on 10.14.3, xcode 11.3

backslash-f commented 4 years ago

Hello,

For me Pecker is failing with a Command PhaseScriptExecution failed with a nonzero exit code / dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib error.

I'm on Xcode 12 (12A7209) and Swift 5.3. Pecker version is 0.4.0 (installed via brew). I'm also on BigSur 11.0 Beta (20A5374g) (but I'm not sure if that plays a role tho).

👋🏻

santi-d commented 3 years ago

anyone could fix this?

Zedd0202 commented 3 years ago

Any news?

I am using CocoaPods and added a build script

${PODS_ROOT}/Pecker/bin/pecker

but I got no warning.

AllioNicholas commented 3 years ago

I'm having the same issue.

Xcode 12.4 (12D4e)

.pecker.yml configuration file includes reporter: "xcode"

No warning shown

c128128 commented 3 years ago

Any updates on this ?