Skip to content

Files

Latest commit

 

History

History
58 lines (37 loc) · 1.03 KB

closure_end_indentation.md

File metadata and controls

58 lines (37 loc) · 1.03 KB

Pattern: Malformed closure end indentation

Issue: -

Description

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

Examples of correct code:

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 }

Examples of incorrect code:

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()
}

Further Reading