Prechádzať zdrojové kódy

Update to SwiftFormat 0.53.5 (#12665)

Paul Beusterien 2 rokov pred
rodič
commit
1af0bf0728

+ 1 - 0
CoreOnly/Tests/FirebasePodTest/FirebasePodTest/AppDelegate.swift

@@ -13,6 +13,7 @@
 // limitations under the License.
 
 import Firebase
+
 // Verify that the following Firebase Swift APIs can be found.
 import FirebaseAnalyticsSwift
 import FirebaseFirestoreSwift

+ 6 - 6
FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsBundle.swift

@@ -72,8 +72,8 @@ struct HeartbeatsBundle: Codable, HeartbeatsPayloadConvertible {
       }
 
       // Update cache with the new heartbeat's date.
-      heartbeat.timePeriods.forEach {
-        lastAddedHeartbeatDates[$0] = heartbeat.date
+      for timePeriod in heartbeat.timePeriods {
+        lastAddedHeartbeatDates[timePeriod] = heartbeat.date
       }
 
     } catch let error as RingBuffer<Heartbeat>.Error {
@@ -98,8 +98,8 @@ struct HeartbeatsBundle: Codable, HeartbeatsPayloadConvertible {
 
       if case .success = secondPushAttempt {
         // Update cache with the new heartbeat's date.
-        diagnosticHeartbeat.timePeriods.forEach {
-          lastAddedHeartbeatDates[$0] = diagnosticHeartbeat.date
+        for timePeriod in diagnosticHeartbeat.timePeriods {
+          lastAddedHeartbeatDates[timePeriod] = diagnosticHeartbeat.date
         }
       }
     } catch {
@@ -124,9 +124,9 @@ struct HeartbeatsBundle: Codable, HeartbeatsPayloadConvertible {
       poppedHeartbeats.append(poppedHeartbeat)
     }
 
-    poppedHeartbeats.reversed().forEach {
+    for poppedHeartbeat in poppedHeartbeats.reversed() {
       do {
-        try buffer.push($0)
+        try buffer.push(poppedHeartbeat)
       } catch {
         // Ignore error.
       }

+ 1 - 0
FirebaseCore/Internal/Tests/Unit/HeartbeatStorageTests.swift

@@ -14,6 +14,7 @@
 
 @testable import FirebaseCoreInternal
 import XCTest
+
 class HeartbeatStorageTests: XCTestCase {
   // MARK: - Instance Management
 

+ 1 - 1
FirebaseCore/Internal/Tests/Unit/HeartbeatTests.swift

@@ -21,7 +21,7 @@ class TimePeriodTests: XCTestCase {
   }
 
   func testTimeIntervals() throws {
-    TimePeriod.allCases.forEach { period in
+    for period in TimePeriod.allCases {
       XCTAssertEqual(period.timeInterval, Double(period.rawValue) * 86400)
     }
   }

+ 1 - 0
FirebaseRemoteConfigSwift/Sources/FirebaseRemoteConfigSwift.swift

@@ -18,6 +18,7 @@
 
 @_exported import enum FirebaseRemoteConfig.RemoteConfigCodableError
 @_exported import struct FirebaseRemoteConfig.RemoteConfigProperty
+
 // The `@_exported` is needed to prevent breaking clients that are using
 // types prefixed with the `FirebaseRemoteConfigSwift` module name (e.g.
 // `FirebaseRemoteConfigSwift.RemoteConfigValueCodableError`).

+ 4 - 4
FirebaseSessions/Sources/FirebaseSessions.swift

@@ -142,8 +142,8 @@ private enum GoogleDataTransportConfig {
 
     super.init()
 
-    SessionsDependencies.dependencies.forEach { subscriberName in
-      self.subscriberPromises[subscriberName] = Promise<Void>.pending()
+    for subscriberName in SessionsDependencies.dependencies {
+      subscriberPromises[subscriberName] = Promise<Void>.pending()
     }
 
     Logger
@@ -226,10 +226,10 @@ private enum GoogleDataTransportConfig {
   }
 
   func addSubscriberFields(event: SessionStartEvent) {
-    subscribers.forEach { subscriber in
+    for subscriber in subscribers {
       event.set(subscriber: subscriber.sessionsSubscriberName,
                 isDataCollectionEnabled: subscriber.isDataCollectionEnabled,
-                appInfo: self.appInfo)
+                appInfo: appInfo)
     }
   }
 

+ 1 - 0
FirebaseSessions/Sources/Installations+InstallationsProtocol.swift

@@ -16,6 +16,7 @@
 import Foundation
 
 @_implementationOnly import FirebaseInstallations
+
 protocol InstallationsProtocol {
   var installationsWaitTimeInSecond: Int { get }
 

+ 69 - 75
FirebaseSessions/Tests/Unit/SessionStartEventTests.swift

@@ -159,11 +159,11 @@ class SessionStartEventTests: XCTestCase {
       ("something unknown", firebase_appquality_sessions_OsName_UNKNOWN_OSNAME),
     ]
 
-    expectations.forEach { (given: String, expected: firebase_appquality_sessions_OsName) in
+    for (given, expected) in expectations {
       appInfo.osName = given
 
       let event = SessionStartEvent(
-        sessionInfo: self.defaultSessionInfo,
+        sessionInfo: defaultSessionInfo,
         appInfo: appInfo,
         time: time
       )
@@ -188,17 +188,16 @@ class SessionStartEventTests: XCTestCase {
       ),
     ]
 
-    expectations.forEach { (given: DevEnvironment,
-                            expected: firebase_appquality_sessions_LogEnvironment) in
-        appInfo.environment = given
+    for (given, expected) in expectations {
+      appInfo.environment = given
 
-        let event = SessionStartEvent(
-          sessionInfo: self.defaultSessionInfo,
-          appInfo: appInfo,
-          time: time
-        )
+      let event = SessionStartEvent(
+        sessionInfo: defaultSessionInfo,
+        appInfo: appInfo,
+        time: time
+      )
 
-        XCTAssertEqual(event.proto.application_info.log_environment, expected)
+      XCTAssertEqual(event.proto.application_info.log_environment, expected)
     }
   }
 
@@ -304,27 +303,26 @@ class SessionStartEventTests: XCTestCase {
       ),
     ]
 
-    expectations.forEach { (given: GULNetworkType,
-                            expected: firebase_appquality_sessions_NetworkConnectionInfo_NetworkType) in
-        let mockNetworkInfo = MockNetworkInfo()
-        mockNetworkInfo.networkType = given
-        appInfo.networkInfo = mockNetworkInfo
+    for (given, expected) in expectations {
+      let mockNetworkInfo = MockNetworkInfo()
+      mockNetworkInfo.networkType = given
+      appInfo.networkInfo = mockNetworkInfo
 
-        let event = SessionStartEvent(
-          sessionInfo: self.defaultSessionInfo,
-          appInfo: appInfo,
-          time: time
-        )
+      let event = SessionStartEvent(
+        sessionInfo: defaultSessionInfo,
+        appInfo: appInfo,
+        time: time
+      )
 
-        // These fields will only be filled in when the Perf SDK is installed
-        event.set(subscriber: .Performance, isDataCollectionEnabled: true, appInfo: appInfo)
+      // These fields will only be filled in when the Perf SDK is installed
+      event.set(subscriber: .Performance, isDataCollectionEnabled: true, appInfo: appInfo)
 
-        testProtoAndDecodedProto(sessionEvent: event) { proto in
-          XCTAssertEqual(
-            event.proto.application_info.apple_app_info.network_connection_info.network_type,
-            expected
-          )
-        }
+      testProtoAndDecodedProto(sessionEvent: event) { proto in
+        XCTAssertEqual(
+          event.proto.application_info.apple_app_info.network_connection_info.network_type,
+          expected
+        )
+      }
     }
   }
 
@@ -385,30 +383,28 @@ class SessionStartEventTests: XCTestCase {
         ),
       ]
 
-      expectations
-        .forEach { (given: String,
-                    expected: firebase_appquality_sessions_NetworkConnectionInfo_MobileSubtype) in
-            let mockNetworkInfo = MockNetworkInfo()
-            mockNetworkInfo.mobileSubtype = given
-            appInfo.networkInfo = mockNetworkInfo
-
-            let event = SessionStartEvent(
-              sessionInfo: self.defaultSessionInfo,
-              appInfo: appInfo,
-              time: time
-            )
-
-            // These fields will only be filled in when the Perf SDK is installed
-            event.set(subscriber: .Performance, isDataCollectionEnabled: true, appInfo: appInfo)
-
-            testProtoAndDecodedProto(sessionEvent: event) { proto in
-              XCTAssertEqual(
-                event.proto.application_info.apple_app_info.network_connection_info
-                  .mobile_subtype,
-                expected
-              )
-            }
+      for (given, expected) in expectations {
+        let mockNetworkInfo = MockNetworkInfo()
+        mockNetworkInfo.mobileSubtype = given
+        appInfo.networkInfo = mockNetworkInfo
+
+        let event = SessionStartEvent(
+          sessionInfo: defaultSessionInfo,
+          appInfo: appInfo,
+          time: time
+        )
+
+        // These fields will only be filled in when the Perf SDK is installed
+        event.set(subscriber: .Performance, isDataCollectionEnabled: true, appInfo: appInfo)
+
+        testProtoAndDecodedProto(sessionEvent: event) { proto in
+          XCTAssertEqual(
+            event.proto.application_info.apple_app_info.network_connection_info
+              .mobile_subtype,
+            expected
+          )
         }
+      }
     }
   #endif // os(iOS) && !targetEnvironment(macCatalyst)
 
@@ -477,30 +473,28 @@ class SessionStartEventTests: XCTestCase {
         ),
       ]
 
-      expectations
-        .forEach { (given: String,
-                    expected: firebase_appquality_sessions_NetworkConnectionInfo_MobileSubtype) in
-            let mockNetworkInfo = MockNetworkInfo()
-            mockNetworkInfo.mobileSubtype = given
-            appInfo.networkInfo = mockNetworkInfo
-
-            let event = SessionStartEvent(
-              sessionInfo: self.defaultSessionInfo,
-              appInfo: appInfo,
-              time: time
-            )
-
-            // These fields will only be filled in when the Perf SDK is installed
-            event.set(subscriber: .Performance, isDataCollectionEnabled: true, appInfo: appInfo)
-
-            testProtoAndDecodedProto(sessionEvent: event) { proto in
-              XCTAssertEqual(
-                event.proto.application_info.apple_app_info.network_connection_info
-                  .mobile_subtype,
-                expected
-              )
-            }
+      for (given, expected) in expectations {
+        let mockNetworkInfo = MockNetworkInfo()
+        mockNetworkInfo.mobileSubtype = given
+        appInfo.networkInfo = mockNetworkInfo
+
+        let event = SessionStartEvent(
+          sessionInfo: defaultSessionInfo,
+          appInfo: appInfo,
+          time: time
+        )
+
+        // These fields will only be filled in when the Perf SDK is installed
+        event.set(subscriber: .Performance, isDataCollectionEnabled: true, appInfo: appInfo)
+
+        testProtoAndDecodedProto(sessionEvent: event) { proto in
+          XCTAssertEqual(
+            event.proto.application_info.apple_app_info.network_connection_info
+              .mobile_subtype,
+            expected
+          )
         }
+      }
     }
   #endif // os(iOS) && !targetEnvironment(macCatalyst)
 }

+ 1 - 1
Mintfile

@@ -1 +1 @@
-nicklockwood/SwiftFormat@0.52.10
+nicklockwood/SwiftFormat@0.53.5