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: Quick Discouraged Pending Test #1909

Closed
ornithocoder opened this issue Oct 17, 2017 · 1 comment
Closed

Rule Request: Quick Discouraged Pending Test #1909

ornithocoder opened this issue Oct 17, 2017 · 1 comment
Labels
rule-request Requests for a new rules.

Comments

@ornithocoder
Copy link
Contributor

ornithocoder commented Oct 17, 2017

There are hella reasons to mark a test as pending. But not many reasons to keep tests as pending forever in the code base. Tests that aren't running are dead code; they make sense as a temporary solution, but not for the eternity. Pending tests should be monitored, reviewed, and refactored every now and then.

This is a rule request to introduce a new opt-in rule, quick_discouraged_pending_test, to warn against pending tests. While some teams might want to have this always on (or off), others might prefer to run it sporadically.

Triggering Examples

class TotoTests: QuickSpec {
   override func spec() {
       xdescribe("foo") { }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       xcontext("foo") { }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       xit("foo") { }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       describe("foo") {
           xit("bar") { }
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       context("foo") {
           xit("bar") { }
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       describe("foo") {
           context("bar") {
               xit("toto") { }
           }
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       pending("foo")
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       xitBehavesLike("foo")
   }
}
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 17, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 17, 2017
@marcelofabri marcelofabri added the rule-request Requests for a new rules. label Oct 17, 2017
@ornithocoder
Copy link
Contributor Author

Merged in #1911.

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