Operator Function Whitespace

Operators should be surrounded by a single whitespace when defining them

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

Non Triggering Examples

func <| (lhs: Int, rhs: Int) -> Int {}
func <|< <A>(lhs: A, rhs: A) -> A {}
func abc(lhs: Int, rhs: Int) -> Int {}

Triggering Examples

func <|(lhs: Int, rhs: Int) -> Int {}
func <|<<A>(lhs: A, rhs: A) -> A {}
func <|  (lhs: Int, rhs: Int) -> Int {}
func <|<  <A>(lhs: A, rhs: A) -> A {}
func  <| (lhs: Int, rhs: Int) -> Int {}
func  <|< <A>(lhs: A, rhs: A) -> A {}