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_focused_test #1905

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

Rule request: quick_discouraged_focused_test #1905

ornithocoder opened this issue Oct 15, 2017 · 1 comment

Comments

@ornithocoder
Copy link
Contributor

ornithocoder commented Oct 15, 2017

It's quite common - in large test suites - the usage of focused test (fdescribe, fcontext, and fit), especially when doing TDD.

Focused test is a pretty handy feature, but not rarely do developers push code with focused test without realizing it :-(

This rule would trigger a warning for focused tests, to remind developers they have focused tests.

Non Triggering Examples

class TotoTests: QuickSpec {
   override func spec() {
       describe("foo") {
           describe("bar") { } 
           context("bar") {
               it("bar") { }
           }
           it("bar") { }
           itBehavesLike("bar")
       }
   }
}

Triggering Examples

class TotoTests: QuickSpec {
   override func spec() {
       fdescribe("foo") {
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       fcontext("foo") {
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       fit("foo") {
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       describe("foo") {
           fit("bar") { }
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       context("foo") {
           fit("bar") { }
       }
   }
}
class TotoTests: QuickSpec {
   override func spec() {
       describe("foo") {
           context("bar") {
               fit("toto") { }
            }
        }
    }
}
class TotoTests: QuickSpec {
   override func spec() {
       fitBehavesLike("foo")
   }
}
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 15, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 15, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 15, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 15, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 15, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Oct 15, 2017
@jpsim
Copy link
Collaborator

jpsim commented Oct 16, 2017

Done in #1906.

@jpsim jpsim closed this as completed Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants