Closure End Indentation

Closure end should have the same indentation as the line that started it.

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

Non Triggering Examples

SignalProducer(values: [1, 2, 3])
   .startWithNext { number in
       print(number)
   }

[1, 2].map { $0 + 1 }

return match(pattern: pattern, with: [.comment]).flatMap { range in
   return Command(string: contents, range: range)
}.flatMap { command in
   return command.expand()
}

foo(foo: bar,
    options: baz) { _ in }

someReallyLongProperty.chainingWithAnotherProperty
   .foo { _ in }
foo(abc, 123)
{ _ in }

function(
    closure: { x in
        print(x)
    },
    anotherClosure: { y in
        print(y)
    })
function(parameter: param,
         closure: { x in
    print(x)
})
function(parameter: param, closure: { x in
        print(x)
    },
    anotherClosure: { y in
        print(y)
    })
(-variable).foo()

Triggering Examples

SignalProducer(values: [1, 2, 3])
   .startWithNext { number in
       print(number)
}

return match(pattern: pattern, with: [.comment]).flatMap { range in
   return Command(string: contents, range: range)
   }.flatMap { command in
   return command.expand()
}

function(
    closure: { x in
        print(x)
},
    anotherClosure: { y in
        print(y)
})