woshiccm / Pecker

CodePecker is a tool to detect unused Swift code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False Positive: Subclasses of subclasses of XCTestCase

noahsark769 opened this issue · comments

If you have a subclass of XCTestCase (e.g. a BaseTestCase where you put your generic testing utilities), Pecker currently reports tests that inherit from this subclass these as unused. For example:

import XCTest

class BaseTestCase: XCTestCase {

}

extension BaseTestCase {
    func a() {
        print("a")
    }
}

class TestCase: BaseTestCase { // currently reported as unused
    func test() { // currently reported as unused
        self.a()
    }
}

Working example in repo: https://github.com/noahsark769/NGPeckerExamples/blob/master/NGPeckerExamplesTests/XCTestSuperclassMethodUsedBySubclass.swift#L11

commented

#6
Others have opened a issue, I am still working on it, so this will be closed😂

Ah oops, you're right! Sorry!