Skip to content

Commit

Permalink
(Bugfix)|SwiftLint crashes due to Swift bug
Browse files Browse the repository at this point in the history
As discussed in realm/SwiftLint#2276, there is a SourceKit bug involving switch case annotations when string interpolation is involved, which throws off an underlying unicode conversion when running the new no_fallthrough_only rule and causes a crash. As a workaround, this moves the string interpolation outside of the switch body.
  • Loading branch information
johnhammerlund committed Jul 3, 2018
1 parent 8d3a4f3 commit 8cd89d3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Sources/Conduit/Networking/URLSessionClientLogging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,26 @@ extension URLSessionClient {
code > 0 else {
return "<No Response> 🚫"
}
let statusSymbol: String

switch code {
case 200..<300:
return "\(code) βœ…"
statusSymbol = "βœ…"
case 300..<400:
return "\(code) β†ͺ️"
statusSymbol = "β†ͺ️"
case 401, 403:
return "\(code) ⛔️"
statusSymbol = "⛔️"
case 404:
return "\(code) πŸ”Ž"
statusSymbol = "πŸ”Ž"
case 400..<500:
return "\(code) ❌"
statusSymbol = "❌"
case 500..<Int.max:
return "\(code) πŸ’₯"
statusSymbol = "πŸ’₯"
default:
return "\(code) ❓"
statusSymbol = "❓"
}

return "\(code) \(statusSymbol)"
}

}

0 comments on commit 8cd89d3

Please sign in to comment.