Forráskód Böngészése

Update and apply swiftformat fix (#6239)

Paul Beusterien 5 éve
szülő
commit
eabe8d46a0

+ 2 - 2
Firestore/Swift/Source/Codable/CollectionReference+WriteEncodable.swift

@@ -35,6 +35,6 @@ extension CollectionReference {
                                         encoder: Firestore.Encoder = Firestore.Encoder(),
                                         completion: ((Error?) -> Void)? = nil) throws
     -> DocumentReference {
-      return addDocument(data: try encoder.encode(value), completion: completion)
-    }
+    return addDocument(data: try encoder.encode(value), completion: completion)
+  }
 }

+ 15 - 15
Firestore/third_party/FirestoreEncoder/FirestoreDecoder.swift

@@ -388,25 +388,25 @@ private struct _FirestoreKeyedDecodingContainer<K: CodingKey>: KeyedDecodingCont
   public func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type,
                                          forKey key: Key) throws
     -> KeyedDecodingContainer<NestedKey> {
-      decoder.codingPath.append(key)
-      defer { self.decoder.codingPath.removeLast() }
-
-      guard let value = self.container[key.stringValue] else {
-        throw DecodingError.valueNotFound(KeyedDecodingContainer<NestedKey>.self,
-                                          DecodingError.Context(codingPath: codingPath,
-                                                                debugDescription: "Cannot get nested keyed container -- no value found for key \"\(key.stringValue)\""))
-      }
+    decoder.codingPath.append(key)
+    defer { self.decoder.codingPath.removeLast() }
 
-      guard let dictionary = value as? [String: Any] else {
-        throw DecodingError
-          ._typeMismatch(at: codingPath, expectation: [String: Any].self, reality: value)
-      }
+    guard let value = self.container[key.stringValue] else {
+      throw DecodingError.valueNotFound(KeyedDecodingContainer<NestedKey>.self,
+                                        DecodingError.Context(codingPath: codingPath,
+                                                              debugDescription: "Cannot get nested keyed container -- no value found for key \"\(key.stringValue)\""))
+    }
 
-      let container = _FirestoreKeyedDecodingContainer<NestedKey>(referencing: decoder,
-                                                                  wrapping: dictionary)
-      return KeyedDecodingContainer(container)
+    guard let dictionary = value as? [String: Any] else {
+      throw DecodingError
+        ._typeMismatch(at: codingPath, expectation: [String: Any].self, reality: value)
     }
 
+    let container = _FirestoreKeyedDecodingContainer<NestedKey>(referencing: decoder,
+                                                                wrapping: dictionary)
+    return KeyedDecodingContainer(container)
+  }
+
   public func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {
     decoder.codingPath.append(key)
     defer { self.decoder.codingPath.removeLast() }

+ 1 - 1
Mintfile

@@ -1 +1 @@
-nicklockwood/SwiftFormat@0.45.3
+nicklockwood/SwiftFormat@0.45.5

+ 1 - 1
README.md

@@ -146,7 +146,7 @@ Travis will verify that any code changes are done in a style compliant way. Inst
 ```
 brew install clang-format
 brew install mint
-mint install swiftformat@0.45.3
+mint install swiftformat@0.45.5
 ```
 
 ### Running Unit Tests

+ 4 - 4
scripts/style.sh

@@ -63,11 +63,11 @@ if [[ "$system" == "Darwin" ]]; then
     echo "Found: $version"
   fi
   version="${version/*version /}"
-  # Ensure the swiftformat version is 0.45.3 (as of 2020-08-07)
+  # Ensure the swiftformat version is 0.45.5 (as of 2020-08-09)
   # Update Mintfile and run command below to update.
-  if [[ "$version" != 0.45.3 ]]; then
-    echo "Version $version installed. Please install swiftformat 0.45.3"
-    echo "brew install mint; mint install nicklockwood/SwiftFormat@0.45.3"
+  if [[ "$version" != 0.45.5 ]]; then
+    echo "Version $version installed. Please install swiftformat 0.45.5"
+    echo "brew install mint; mint install nicklockwood/SwiftFormat@0.45.5"
     exit 1
   fi
 fi