Swiftlint: `func ==()` false positive?

Created on 9 Apr 2016  路  2Comments  路  Source: realm/SwiftLint

The following triggers a operator_whitespace warning.

warning: Operator Function Whitespace Violation: Operators should be surrounded by a single whitespace when defining them. (operator_whitespace)

func ==(lhs: Foo, rhs: Foo) -> Bool {
    return lhs.name == rhs.name
}

I don't know what the desired behavior is. I kind of like the extra space in this case.

question

Most helpful comment

The operator whitespace warning expects a single space on _both_ sides of the operator, e.g.

func == (lhs: Foo, rhs: Foo) -> Bool {
    return lhs.name == rhs.name
}

All 2 comments

The operator whitespace warning expects a single space on _both_ sides of the operator, e.g.

func == (lhs: Foo, rhs: Foo) -> Bool {
    return lhs.name == rhs.name
}

I understand that. It was more "does this conflict with function naming that requires no space between the function name and the lparen".

Was this page helpful?
0 / 5 - 0 ratings