woshiccm / Pecker

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

XCTestRule false positive if using subclass of XCTestCase #6

Closed Sherlouk closed 4 years ago

Sherlouk commented 4 years ago

I'm getting a warning "Pecker: function testSomeFunction() was never used; consider removing it" in a test class. This is true for any test function in a class which doesn't immediately subclass XCTestCase.

class FooTests: XCTestCase {
  func testSomething() { // No Warning
  }
}

class BarTests: FooTests {
  func testSomethingElse() { // Warning
  }
}

Given that it's still a valid test class, I wouldn't expect this to raise a warning! (Temporary workaround has just been to exclude the tests directory, though this isn't ideal)

woshiccm commented 4 years ago

Coool, I didn't consider this situation, and I should be able to solve this problem tomorrow

woshiccm commented 4 years ago

Fixed, the version is 0.0.12