Skip to content

Commit

Permalink
Update SwiftLint to v0.55.1 (#290)
Browse files Browse the repository at this point in the history
Updates our version of SwiftLint, but opts out of one of the new rules
because making the required changes:

```diff
--- a/Libraries/Connect/Internal/Interceptors/GRPCWebInterceptor.swift
+++ b/Libraries/Connect/Internal/Interceptors/GRPCWebInterceptor.swift
@@ -260,17 +260,11 @@ extension GRPCWebInterceptor: StreamInterceptor {
     }
 }
 
-private struct TrailersDecodingError: Error {}
-
 private extension Trailers {
     static func fromGRPCHeadersBlock(_ source: Data) throws -> Self {
-        guard let string = String(data: source, encoding: .utf8) else {
-            throw TrailersDecodingError()
-        }
-
         // Decode trailers based on gRPC Web spec:
         // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md
-        return string
+        return String(decoding: source, as: UTF8.self)
             .split(separator: "\r\n")
             .reduce(into: Trailers()) { trailers, line in
                 guard let separatorIndex = line.firstIndex(of: ":") else {
```

Caused some tests to fail:

```
FAILED: gRPC-Web Unexpected Responses/HTTPVersion:1/TLS:false/trailers-in-body/unary/multiple-responses:
	actual error {code: 2 (unknown), message: "RPC response missing status"} does not match expected code 12 (unimplemented)
```

It looks like there was some discussion around this rule being
potentially problematic here:
realm/SwiftLint#5263 (comment)

Signed-off-by: Michael Rebello <[email protected]>
  • Loading branch information
rebello95 authored Aug 15, 2024
1 parent a4191ad commit 51d24b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
run-swiftlint:
runs-on: ubuntu-latest
container:
image: ghcr.io/realm/swiftlint:0.53.0
image: ghcr.io/realm/swiftlint:0.55.1
steps:
- uses: actions/checkout@v4
- name: Run SwiftLint
Expand Down
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ disabled_rules:
- identifier_name
- opening_brace
- nesting
- non_optional_string_data_conversion
- redundant_string_enum_value
- todo
- type_body_length
Expand Down

0 comments on commit 51d24b0

Please sign in to comment.