Skip to content

Enforce bracket styles (Part 3) #100

@adityatrivedi

Description

@adityatrivedi

Close brace should be on a new line by itself.

  • class
class SomeClass: SomeSuperClass {
}

class Demo {
}
  • function
func someMethod() {
}
  • conditional
if someCondition {
}

else if someCondition {
}

else {
}

switch someCase {
  default:
      break
}
  • loops
for var x = 0; x < 10; x+=1 {
}

for ; ; {
}

for var x ; ; {
}

for ; x ; {
}

for ; ; x {
}

for var x; x ; {
}

for var x; ; x {
}

for ; x ; x {
}

while someCondition {
}

repeat {
} while someCondition

for someElement in someCollection {
}
  • initializer
init(length:Double, breadth:Double) {
   self.length = length
   self.breadth = breadth
}
  • struct
struct DemoStruct : SomeParentStruct {
}

struct DemoStruct {
}
  • setters
set {
    oldValue = newValue / 2
}
  • getters
get {
    return value * 2
}
  • extensions
extension someExtension {
}
  • protocols
protocol someProtocol {
}
  • enums
enum someEnum {
}
  • closure
func someFunction () -> () {
// closure
}

NOTE: Closing brace checks for single-line closures will not be enforced, but closing brace checks for multiline closures are enforced.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions