Multiline Literal Brackets
Multiline literals should have their surrounding brackets in a new line
- Identifier:
multiline_literal_brackets
- Enabled by default: No
- Supports autocorrection: No
- Kind: style
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
let trio = ["harry", "ronald", "hermione"]
let houseCup = ["gryffindor": 460, "hufflepuff": 370, "ravenclaw": 410, "slytherin": 450]
let trio = [
"harry",
"ronald",
"hermione"
]
let houseCup = [
"gryffindor": 460,
"hufflepuff": 370,
"ravenclaw": 410,
"slytherin": 450
]
let trio = [
"harry", "ronald", "hermione"
]
let houseCup = [
"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450
]
_ = [
1,
2,
3,
4,
5, 6,
7, 8, 9
]
Triggering Examples
let trio = [↓"harry",
"ronald",
"hermione"
]
let houseCup = [↓"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450
]
let houseCup = [↓"gryffindor": 460,
"hufflepuff": 370,
"ravenclaw": 410,
"slytherin": 450↓]
let trio = [
"harry",
"ronald",
"hermione"↓]
let houseCup = [
"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450↓]
class Hogwarts {
let houseCup = [
"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450↓]
}
_ = [
1,
2,
3,
4,
5, 6,
7, 8, 9↓]
_ = [↓1, 2, 3,
4, 5, 6,
7, 8, 9
]
class Hogwarts {
let houseCup = [
"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": slytherinPoints.filter {
$0.isValid
}.sum()↓]
}