opening_brace - ApplebaumIan/BitbucketAPI GitHub Wiki

Opening Brace Spacing

Opening braces should be preceded by a single space and on the same line as the declaration.

  • Identifier: opening_brace
  • Enabled by default: Enabled
  • Supports autocorrection: Yes
  • Kind: style
  • Analyzer rule: No
  • Minimum Swift compiler version: 3.0.0
  • Default configuration: warning

Non Triggering Examples

func abc() {
}
[].map() { $0 }
[].map({ })
if let a = b { }
while a == b { }
guard let a = b else { }
if
	let a = b,
	let c = d
	where a == c
{ }
while
	let a = b,
	let c = d
	where a == c
{ }
guard
	let a = b,
	let c = d
	where a == c else
{ }
struct Rule {}

struct Parent {
	struct Child {
		let foo: Int
	}
}

func f(rect: CGRect) {
   {
      let centre = CGPoint(x: rect.midX, y: rect.midY)
      print(centre)
   }()
}

Triggering Examples

func abc()โ†“{
}
func abc()
	โ†“{ }
[].map()โ†“{ $0 }
[].map( โ†“{ } )
if let a = bโ†“{ }
while a == bโ†“{ }
guard let a = b elseโ†“{ }
if
	let a = b,
	let c = d
	where a == cโ†“{ }
while
	let a = b,
	let c = d
	where a == cโ†“{ }
guard
	let a = b,
	let c = d
	where a == c elseโ†“{ }
struct Ruleโ†“{}

struct Rule
โ†“{
}

struct Rule

	โ†“{
}

struct Parent {
	struct Child
	โ†“{
		let foo: Int
	}
}

// Get the current thread's TLS pointer. On first call for a given thread,
// creates and initializes a new one.
internal static func getPointer()
  -> UnsafeMutablePointer<_ThreadLocalStorage>
{ // <- here
  return _swift_stdlib_threadLocalStorageGet().assumingMemoryBound(
    to: _ThreadLocalStorage.self)
}
func run_Array_method1x(_ N: Int) {
  let existentialArray = array!
  for _ in 0 ..< N * 100 {
    for elt in existentialArray {
      if !elt.doIt()  {
        fatalError("expected true")
      }
    }
  }
}

func run_Array_method2x(_ N: Int) {

}