Vertical Whitespace before Closing Braces
Don’t include vertical whitespace (empty line) before closing braces
- Identifier:
vertical_whitespace_closing_braces
- Enabled by default: No
- Supports autocorrection: Yes
- Kind: style
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning only_enforce_before_trivial_lines false
Non Triggering Examples
[
1,
2,
3
]
do {
print("x is 5")
}
do {
print("x is 5")
}
do {
print("x is 5")
}
foo(
x: 5,
y:6
)
func foo() {
run(5) { x in
print(x)
}
}
//
// only_enforce_before_trivial_lines: true
//
print([
1
])
//
// only_enforce_before_trivial_lines: true
//
print([foo {
var sum = 0
for i in 1...5 { sum += i }
return sum
}, foo {
var mul = 1
for i in 1...5 { mul *= i }
return mul
}])
[1, 2].map { $0 }.filter { true }
[1, 2].map { $0 }.filter { num in true }
/*
class X {
let x = 5
}
*/
Triggering Examples
[
1,
2,
3
↓
]
do {
print("x is 5")
↓
}
do {
print("x is 5")
↓
}
do {
print("x is 5")
↓
}
foo(
x: 5,
y:6
↓
)
func foo() {
run(5) { x in
print(x)
}
↓
}
//
// only_enforce_before_trivial_lines: true
//
print([
1
↓
])
//
// only_enforce_before_trivial_lines: true
//
print([foo {
var sum = 0
for i in 1...5 { sum += i }
return sum
}, foo {
var mul = 1
for i in 1...5 { mul *= i }
return mul
↓
}])