Nimble Operator

Prefer Nimble operator overloads over free matcher functions

  • Identifier: nimble_operator
  • Enabled by default: No
  • Supports autocorrection: Yes
  • Kind: idiomatic
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning

Non Triggering Examples

expect(seagull.squawk) != "Hi!"
expect("Hi!") == "Hi!"
expect(10) > 2
expect(10) >= 10
expect(10) < 11
expect(10) <= 10
expect(x) === x
expect(10) == 10
expect(success) == true
expect(value) == nil
expect(value) != nil
expect(object.asyncFunction()).toEventually(equal(1))
expect(actual).to(haveCount(expected))
foo.method {
    expect(value).to(equal(expectedValue), description: "Failed")
    return Bar(value: ())
}

Triggering Examples

expect(seagull.squawk).toNot(equal("Hi"))
expect(12).toNot(equal(10))
expect(10).to(equal(10))
expect(10, line: 1).to(equal(10))
expect(10).to(beGreaterThan(8))
expect(10).to(beGreaterThanOrEqualTo(10))
expect(10).to(beLessThan(11))
expect(10).to(beLessThanOrEqualTo(10))
expect(x).to(beIdenticalTo(x))
expect(success).to(beTrue())
expect(success).to(beFalse())
expect(value).to(beNil())
expect(value).toNot(beNil())
expect(10) > 2
 expect(10).to(beGreaterThan(2))