mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
Make vertical_whitespace_between_cases rule work when case block ends with a string literal (#5628)
This commit is contained in:
@@ -31,6 +31,11 @@
|
||||
`unneeded_synthesized_initializer` rule.
|
||||
[SimplyDanny](https://github.com/SimplyDanny)
|
||||
[#5153](https://github.com/realm/SwiftLint/issues/5153)
|
||||
|
||||
* Make `vertical_whitespace_between_cases` rule work for
|
||||
cases ending with a string literal.
|
||||
[ilendemli](https://github.com/ilendemli)
|
||||
[#5612](https://github.com/realm/SwiftLint/issues/5612)
|
||||
|
||||
* Ignore access level modifiers restricted to value setting in
|
||||
`extension_access_modifier` rule.
|
||||
|
||||
@@ -3,7 +3,7 @@ import SourceKittenFramework
|
||||
|
||||
private extension SwiftLintFile {
|
||||
func violatingRanges(for pattern: String) -> [NSRange] {
|
||||
return match(pattern: pattern, excludingSyntaxKinds: SyntaxKind.commentAndStringKinds)
|
||||
return match(pattern: pattern, excludingSyntaxKinds: SyntaxKind.commentKinds)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,22 @@ struct VerticalWhitespaceBetweenCasesRule: Rule {
|
||||
]
|
||||
|
||||
private static let violatingToValidExamples: [Example: Example] = [
|
||||
Example("""
|
||||
switch x {
|
||||
case 0..<5:
|
||||
return "x is valid"
|
||||
↓ default:
|
||||
return "x is invalid"
|
||||
}
|
||||
"""): Example("""
|
||||
switch x {
|
||||
case 0..<5:
|
||||
return "x is valid"
|
||||
|
||||
default:
|
||||
return "x is invalid"
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
switch x {
|
||||
case 0..<5:
|
||||
|
||||
Reference in New Issue
Block a user