Skip to content
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

Rule Request: Empty XCTest Method #2190

Closed
ornithocoder opened this issue May 8, 2018 · 1 comment
Closed

Rule Request: Empty XCTest Method #2190

ornithocoder opened this issue May 8, 2018 · 1 comment
Labels
rule-request Requests for a new rules.

Comments

@ornithocoder
Copy link
Contributor

ornithocoder commented May 8, 2018

Rule Request

I believe there are two - probably more - cases that can lead to empty tests during development.

  1. It's common to layout the tests when developing a new functionality and one might forget to remove unneeded tests before submitting the code for Code Review.
  2. When refactoring code it's common to comment out tests that also require refactoring and one might forget to uncomment and refactor these tests before submitting the new patch set to Code Review.

In the last two weeks I caught this issue twice on Code Reviews. The rule would have thrown a violation to the developer before they could submit the code to Code Review.

Considerations:

  • Should the rule be configurable, if so what parameters should be configurable? Severity only.
  • Should the rule be opt-in or enabled by default? Why? I believe opt-in would be fine.
// This triggers a violation:
override func setUp() {
}

overridefunc tearDown() { }

func testFoo() {


}

func testBar() {
    // comment...

    // comment...

    // comment...
}
@marcelofabri
Copy link
Collaborator

Implemented in #2189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

2 participants