periphery icon indicating copy to clipboard operation
periphery copied to clipboard

False positive on Delegate functions when superclass defines the conformance

Open WJacobsNL opened this issue 10 months ago • 2 comments

I found false positives in our project on "unused functions"

For instance, I got the result that the func scrollViewDidScroll(_ scrollView: UIScrollView) is not being used. But actually the superclass of my class already conforms to the UIScrollViewDelegate, so this function is being called in the end.

I also noticed the same, when conforming to a UITableViewDelegate protocol, the UIScrollViewDelegate methods are flagged as being unused, while conforming to UITableViewDelegate, also makes you conform to UIScrollViewDelegate (and the functions are being triggered)

WJacobsNL avatar Apr 04 '25 10:04 WJacobsNL

I am unable to reproduce this. Can you please provide a sample project that demonstrates the issue?

ileitch avatar Apr 05 '25 15:04 ileitch

I made a very small project that shows the inheritance problem. If you run periphery scan on this project, it marks scrollViewDidScroll(_:) as unused

PeripheryTest.zip

WJacobsNL avatar Apr 10 '25 07:04 WJacobsNL