Update documentation for multiline_arguments_brackets and multiline_literal_brackets (#4098)

- added two triggering examples that are a common style, to make it immediately obvious that they trigger the rules
- also fixed a spelling mistake throughout the examples for the multiline_literal_brackets rule ("Gryffindor" is now correctly spelt)
This commit is contained in:
chrisjf
2022-08-18 03:53:52 -04:00
committed by GitHub
parent 3aa249b8a1
commit 1ef15f3bb7
3 changed files with 23 additions and 6 deletions
+6
View File
@@ -82,6 +82,12 @@ accordingly._
`swiftlint` executables are identical.
[JP Simard](https://github.com/jpsim)
* Update documentation for `multiline_arguments_brackets` and
`multiline_literal_brackets` to make it immediately obvious that common
examples will trigger.
[chrisjf](https://github.com/chrisjf)
[#4060](https://github.com/realm/SwiftLint/issues/4060)
#### Bug Fixes
* Fix false positive in `self_in_property_initialization` rule when using
@@ -87,6 +87,11 @@ public struct MultilineArgumentsBracketsRule: ASTRule, OptInRule, ConfigurationP
param3: "Param3")
"""),
Example("""
foo(param1: "Param1",
param2: "Param2",
param3: "Param3")
"""),
Example("""
foo(bar(
x: 5,
y: 7
@@ -14,7 +14,7 @@ public struct MultilineLiteralBracketsRule: ASTRule, OptInRule, ConfigurationPro
nonTriggeringExamples: [
Example("""
let trio = ["harry", "ronald", "hermione"]
let houseCup = ["gryffinder": 460, "hufflepuff": 370, "ravenclaw": 410, "slytherin": 450]
let houseCup = ["gryffindor": 460, "hufflepuff": 370, "ravenclaw": 410, "slytherin": 450]
"""),
Example("""
let trio = [
@@ -23,7 +23,7 @@ public struct MultilineLiteralBracketsRule: ASTRule, OptInRule, ConfigurationPro
"hermione"
]
let houseCup = [
"gryffinder": 460,
"gryffindor": 460,
"hufflepuff": 370,
"ravenclaw": 410,
"slytherin": 450
@@ -34,7 +34,7 @@ public struct MultilineLiteralBracketsRule: ASTRule, OptInRule, ConfigurationPro
"harry", "ronald", "hermione"
]
let houseCup = [
"gryffinder": 460, "hufflepuff": 370,
"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450
]
"""),
@@ -57,11 +57,17 @@ public struct MultilineLiteralBracketsRule: ASTRule, OptInRule, ConfigurationPro
]
"""),
Example("""
let houseCup = ["gryffinder": 460, "hufflepuff": 370,
let houseCup = ["gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450
]
"""),
Example("""
let houseCup = ["gryffindor": 460,
"hufflepuff": 370,
"ravenclaw": 410,
"slytherin": 450]
"""),
Example("""
let trio = [
"harry",
"ronald",
@@ -69,13 +75,13 @@ public struct MultilineLiteralBracketsRule: ASTRule, OptInRule, ConfigurationPro
"""),
Example("""
let houseCup = [
"gryffinder": 460, "hufflepuff": 370,
"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450]
"""),
Example("""
class Hogwarts {
let houseCup = [
"gryffinder": 460, "hufflepuff": 370,
"gryffindor": 460, "hufflepuff": 370,
"ravenclaw": 410, "slytherin": 450]
}
"""),