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: Prefer specific matcher over `XCTAssertEqual`/`XCTAssertNotEqual` #1874

Closed
marcelofabri opened this Issue Oct 2, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@marcelofabri
Copy link
Collaborator

marcelofabri commented Oct 2, 2017

New Issue Checklist

Rule Request

  1. Why should this rule be added? Share links to existing discussion about what
    the community thinks about this.

XCTAssertFalse, XCTAssertTrue,XCTAssertNil, XCTAssertNotNil should be used over XCTAssertEqual/XCTAssertNotEqual.

  1. Provide several examples of what would and wouldn't trigger violations.
// triggers
XCTAssertEqual(foo, true)
XCTAssertEqual(foo, false)
XCTAssertNotEqual(foo, false)
XCTAssertEqual(foo, nil)
XCTAssertNotEqual(foo, nil)


// doesn't trigger
XCTAssertFalse(foo)
XCTAssertTrue(foo)
XCTAssertNil(foo)
XCTAssertNotNil(foo)
XCTAssertEqual(foo, 2)
XCTAssertNotEqual(foo, "false")
  1. Should the rule be configurable, if so what parameters should be configurable?

Just severity.

  1. Should the rule be opt-in or enabled by default? Why?
    See README.md for guidelines on when to mark a rule as opt-in.

Probably as a default rule, even though there's a risk of false positives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment