Multiline Arguments Brackets

Multiline arguments should have their surrounding brackets in a new line

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

Non Triggering Examples

foo(param1: "Param1", param2: "Param2", param3: "Param3")
foo(
    param1: "Param1", param2: "Param2", param3: "Param3"
)
func foo(
    param1: "Param1",
    param2: "Param2",
    param3: "Param3"
)
foo { param1, param2 in
    print("hello world")
}
foo(
    bar(
        x: 5,
        y: 7
    )
)
AlertViewModel.AlertAction(title: "some title", style: .default) {
    AlertManager.shared.presentNextDebugAlert()
}
public final class Logger {
    public static let shared = Logger(outputs: [
        OSLoggerOutput(),
        ErrorLoggerOutput()
    ])
}
let errors = try self.download([
    (description: description, priority: priority),
])
return SignalProducer({ observer, _ in
    observer.sendCompleted()
}).onMainQueue()
SomeType(a: [
    1, 2, 3
], b: [1, 2])
SomeType(
  a: 1
) { print("completion") }
SomeType(
  a: 1
) {
  print("completion")
}
SomeType(
  a: .init() { print("completion") }
)
SomeType(
  a: .init() {
    print("completion")
  }
)
SomeType(
  a: 1
) {} onError: {}

Triggering Examples

foo(param1: "Param1", param2: "Param2",
         param3: "Param3"
)
foo(
    param1: "Param1",
    param2: "Param2",
    param3: "Param3")
foo(param1: "Param1",
    param2: "Param2",
    param3: "Param3")
foo(bar(
    x: 5,
    y: 7
)
)
foo(
    bar(
        x: 5,
        y: 7
))
SomeOtherType(a: [
        1, 2, 3
    ],
    b: "two")
SomeOtherType(
  a: 1) {}
SomeOtherType(
  a: 1) {
  print("completion")
}