Using periphery

Periphery is a promissing looking tool for finding dead code!. I have unsuccessfully tried it the past and finally I found a way to build my project correctly with it.

Short explanation, CODE_SIGNING_ALLOWED=NO is set by default however in some xcode projects some files (usually old .frameworks) might have the "Code Sign on Copy" setting set to YES (on Target > Build Phases > Copy files). This kind of projects need CODE_SIGNING_ALLOWED=YES.

Below is an example of my .periphery.yml file:

project: MyProject.xcodeproj
retain_objc_accessible: true
retain_public: true
schemes:
- MyScheme
targets:
- MyTargetTests
- MyTarget
verbose: true
clean_build: true
build_arguments:
- -destination
- platform="iOS Simulator,name=iPhone 8,OS=latest"
- CODE_SIGNING_ALLOWED="YES"

Run it

periphery scan --config .periphery.yml
Default ouput format is xcode which is good for xcode integration and for humans that like to read the terminal. Probably json output is probably easier for integrate with other services like Sonarqube custom issues, etc :)

0 comments :

This work is licensed under BSD Zero Clause License | nacho4d ®