Skip to content

Commit

Permalink
(Bugfix)|SwiftLint crashes due to Swift bug (#97)
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 authored Jul 3, 2018
1 parent 8d3a4f3 commit 02fd79d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- None

#### Bug Fixes
- None
- Added workaround to fix SwiftLint crash: https://github.com/mindbody/Conduit/pull/97

#### Other
- None
Expand Down
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 02fd79d

Please sign in to comment.