mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
@@ -18,6 +18,10 @@
|
||||
[Norio Nomura](https://github.com/norio-nomura)
|
||||
[#593](https://github.com/realm/SwiftLint/issues/593)
|
||||
|
||||
* `ClosingBraceRule` no longer triggers across line breaks.
|
||||
[Josh Friend](https://github.com/joshfriend)
|
||||
[#592](https://github.com/realm/SwiftLint/issues/592)
|
||||
|
||||
## 0.9.2: Multiple Exhaust Codes
|
||||
|
||||
##### Breaking
|
||||
|
||||
@@ -14,7 +14,7 @@ private let whitespaceAndNewlineCharacterSet = NSCharacterSet.whitespaceAndNewli
|
||||
extension File {
|
||||
private func violatingClosingBraceRanges() -> [NSRange] {
|
||||
return matchPattern(
|
||||
"(\\}\\s+\\))",
|
||||
"(\\}[ \\t]+\\))",
|
||||
excludingSyntaxKinds: SyntaxKind.commentAndStringKinds()
|
||||
)
|
||||
}
|
||||
@@ -32,16 +32,19 @@ public struct ClosingBraceRule: CorrectableRule, ConfigurationProviderRule {
|
||||
description: "Closing brace with closing parenthesis " +
|
||||
"should not have any whitespaces in the middle.",
|
||||
nonTriggeringExamples: [
|
||||
"[].map({ })"
|
||||
"[].map({ })",
|
||||
"[].map(\n { }\n)"
|
||||
],
|
||||
triggeringExamples: [
|
||||
"[].map({ ↓} )"
|
||||
"[].map({ ↓} )",
|
||||
"[].map({ }\t)"
|
||||
],
|
||||
corrections: [
|
||||
"[].map({ } )\n": "[].map({ })\n"
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
public func validateFile(file: File) -> [StyleViolation] {
|
||||
return file.violatingClosingBraceRanges().map {
|
||||
StyleViolation(ruleDescription: self.dynamicType.description,
|
||||
|
||||
Reference in New Issue
Block a user