Rename multilineSwitchCases rule to wrapSwitchCases

This commit is contained in:
Nick Lockwood
2020-08-28 10:35:38 +01:00
parent 8202a5ab20
commit 0765da5f9d
4 changed files with 32 additions and 32 deletions
+24 -24
View File
@@ -21,7 +21,6 @@
* [linebreakAtEndOfFile](#linebreakAtEndOfFile)
* [linebreaks](#linebreaks)
* [modifierOrder](#modifierOrder)
* [multilineSwitchCases](#multilineSwitchCases)
* [numberFormatting](#numberFormatting)
* [organizeDeclarations](#organizeDeclarations)
* [preferKeyPath](#preferKeyPath)
@@ -70,6 +69,7 @@
* [wrapAttributes](#wrapAttributes)
* [wrapEnumCases](#wrapEnumCases)
* [wrapMultilineStatementBraces](#wrapMultilineStatementBraces)
* [wrapSwitchCases](#wrapSwitchCases)
* [yodaConditions](#yodaConditions)
----------
@@ -632,29 +632,6 @@ Option | Description
</details>
<br/>
## multilineSwitchCases
Writes one switch case per line.
<details>
<summary>Examples</summary>
```diff
switch foo {
- case .bar, .baz:
break
}
switch foo {
+ case .foo,
+ .bar:
break
}
```
</details>
<br/>
## numberFormatting
Use consistent grouping for numeric literals. Groups will be separated by `_`
@@ -1879,6 +1856,29 @@ Wrap the opening brace of multiline statements.
</details>
<br/>
## wrapSwitchCases
Writes one switch case per line.
<details>
<summary>Examples</summary>
```diff
switch foo {
- case .bar, .baz:
break
}
switch foo {
+ case .foo,
+ .bar:
break
}
```
</details>
<br/>
## yodaConditions
Prefer constant values to be on the right-hand-side of expressions.
+1 -1
View File
@@ -922,7 +922,7 @@ private struct Examples {
```
"""
let multilineSwitchCases = """
let wrapSwitchCases = """
```diff
switch foo {
- case .bar, .baz:
+1 -1
View File
@@ -3542,7 +3542,7 @@ public struct _FormatRules {
}
/// Writes one switch case per line
public let multilineSwitchCases = FormatRule(
public let wrapSwitchCases = FormatRule(
help: "Writes one switch case per line.",
disabledByDefault: true,
sharedOptions: ["linebreaks", "tabwidth", "indent", "smarttabs"]
+6 -6
View File
@@ -5011,7 +5011,7 @@ class RulesTests: XCTestCase {
testFormatting(for: input, rule: FormatRules.wrapEnumCases)
}
// MARK: multilineSwitchCases
// MARK: wrapSwitchCases
func testMultilineSwitchCases() {
let input = """
@@ -5036,7 +5036,7 @@ class RulesTests: XCTestCase {
}
}
"""
testFormatting(for: input, output, rule: FormatRules.multilineSwitchCases)
testFormatting(for: input, output, rule: FormatRules.wrapSwitchCases)
}
func testIfAfterSwitchCaseNotWrapped() {
@@ -5051,7 +5051,7 @@ class RulesTests: XCTestCase {
throw error
}
"""
testFormatting(for: input, rule: FormatRules.multilineSwitchCases)
testFormatting(for: input, rule: FormatRules.wrapSwitchCases)
}
// MARK: - void
@@ -8753,7 +8753,7 @@ class RulesTests: XCTestCase {
let input = "switch foo {\ncase .foo(let bar), .bar(let bar):\n}"
let output = "switch foo {\ncase let .foo(bar), let .bar(bar):\n}"
testFormatting(for: input, output, rule: FormatRules.hoistPatternLet,
exclude: ["multilineSwitchCases"])
exclude: ["wrapSwitchCases"])
}
func testHoistCatchLet() {
@@ -8877,7 +8877,7 @@ class RulesTests: XCTestCase {
let output = "switch foo {\ncase .foo(let bar), .bar(let bar):\n}"
let options = FormatOptions(hoistPatternLet: false)
testFormatting(for: input, output, rule: FormatRules.hoistPatternLet, options: options,
exclude: ["multilineSwitchCases"])
exclude: ["wrapSwitchCases"])
}
func testUnhoistCommaSeparatedSwitchCaseLets2() {
@@ -8885,7 +8885,7 @@ class RulesTests: XCTestCase {
let output = "switch foo {\ncase Foo.foo(let bar), Foo.bar(let bar):\n}"
let options = FormatOptions(hoistPatternLet: false)
testFormatting(for: input, output, rule: FormatRules.hoistPatternLet, options: options,
exclude: ["multilineSwitchCases"])
exclude: ["wrapSwitchCases"])
}
func testUnhoistCatchLet() {