-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
balanced_xctest_lifecycle, single_test_class, empty_xctest_method and test_case_accessibility do not work on when the parent class is a subclass of XCTestCase #4200
Comments
it looks like the code is checking that the class being linted does inherit from XCTestCase, even indirectly, here
I did try to hack in some debugging, but was unable to build SwiftLint locally :-( |
These rules do not know anything about the type hierarchy. Being AST-based, they only check whether there is It would be an option to add a configuration to all these rules that allows to specify other classes you consider to be test cases. |
So I just had a go at adding an I have this on a local branch, but was unable to push this branch up, presumably because of github permissions. |
Do you call SwiftLint in its own build phase like explained here? That should actually work fine even with a manually compiled SwiftLint binary.
This repository does not allow direct pushes. Please use a fork and create a pull request when your change is ready to be reviewed. |
yep, although mine looks like this:
will do |
#4262 resolves this, so closing ... |
New Issue Checklist
Describe the bug
balanced_xctest_lifecycle, single_test_class, empty_xctest_method and test_case_accessibility work fine for me on XCTestCase subclasses.
However if the parent class is a subclass of XCTestCase, then these rules do not fire.
Complete output when running SwiftLint, including the stack trace and command used
Here SwiftLintDemoTests.swift and BrokenSwiftLintDemoTests.swift are identical, except that the classes in BrokenSwiftLintDemoTests.swift inherit from MyTestCase.swift (a subclass of XCTestCase).
Environment
SwiftLintDemo.zip
The text was updated successfully, but these errors were encountered: