Skip to content

Commit 81bc4b6

Browse files
chore: resolving swift formatting errors (#3906)
* chore: resolve SwiftFormat errors and warnings at the categories module (#3843) * resolve swiftformat errors and warnings * resolve review comments * move braces back to same-line * fix argument spacing * chore(analytics): resolve swiftformat errors and warnings (#3844) * chore(analytics): resolve swiftformat errors and warnings * chore(analytics): resolve swiftformat errors and warnings * resolve review comments * fix build errors * chore(notifications): resolve swiftformat errors and warnings (#3853) * chore(notifications): resolve swiftformat errors and warnings * updated swiftformat rules * chore(datastore): resolve swiftformat errors and warnings (#3848) * chore(datastore): resolve swiftformat errors and warnings * updated swiftformat rules * fix build error * update rules * fix build error * fix brace alignment * chore(api): resolve swiftformat errors and warnings (#3845) * chore(api): resolve swiftformat errors and warnings * updated swiftformat rules * fix build error * update rules * chore(logging): resolve swiftformat errors and warnings (#3850) * chore(logging): resolve swiftformat errors and warnings * updated swiftformat rules * chore(geo): resolve swiftformat errors and warnings (#3849) * chore(geo): resolve swiftformat errors and warnings * updated swiftformat rules * update rules * chore(predictions): resolve swiftformat errors and warnings (#3851) * chore(predictions): resolve swiftformat errors and warnings * updated swiftformat rules * remove duplicate import statement * chore(core): resolve swiftformat errors and warnings (#3847) * chore(core): resolve swiftformat errors and warnings * updated swiftformat rules * fix build error * fix build error * update rules * chore: resolve swiftformat errors and warnings in test modules (#3854) * chore: resolve swiftformat errors and warnings * updated swiftformat rules * update rules * chore(storage): resolve swiftformat errors and warnings (#3852) * chore(storage): resolve swiftformat errors and warnings * updated swiftformat rules * update rules * chore(auth): resolve swiftformat errors and warnings (#3846) * chore(auth): resolve swiftformat errors and warnings * updated swiftformat rules * fix build error * fix build error * update rules * fix build error * remove commented code * align comments * fix spacing * resolve latest swift format changes * chore: resolve build failure after rebase with main * chore: update changes after swiftformat command * chore: update code --------- Co-authored-by: Abhash Kumar Singh <[email protected]>
1 parent acdd2dc commit 81bc4b6

File tree

2,832 files changed

+58728
-43039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,832 files changed

+58728
-43039
lines changed

.swiftformat

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@
6565
--enable void
6666
--empty void
6767

68-
--disable wrapArguments
69-
--closingparen same-line
70-
--wraparguments after-first
68+
--enable wrapArguments
69+
--closingparen balanced
70+
--wraparguments before-first
7171
--wrapcollections before-first
72+
--wrapconditions preserve
7273

7374
# standalone rules
75+
--disable preferKeyPath
76+
--disable conditionalAssignment
77+
--disable wrapMultilineConditionalAssignment
78+
--disable wrapMultilineStatementBraces
7479
--disable andOperator
7580
--disable anyObjectProtocol
7681
--disable blankLinesAroundMark
@@ -114,4 +119,4 @@
114119
--enable strongifiedSelf
115120
--disable todos
116121
--enable typeSugar
117-
--enable yodaConditions
122+
--enable yodaConditions

Amplify/Amplify.swift

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,63 +37,63 @@ public class Amplify: @unchecked Sendable {
3737

3838
/// - Tag: Amplify.Analytics
3939
private static let analyticsAtomic = AtomicValue<AnalyticsCategory>(initialValue: AnalyticsCategory())
40-
public static internal(set) var Analytics: AnalyticsCategory {
40+
public internal(set) static var Analytics: AnalyticsCategory {
4141
get { analyticsAtomic.get() }
4242
set { analyticsAtomic.set(newValue) }
4343
}
4444

4545
/// - Tag: Amplify.API
4646
private static let apiAtomic = AtomicValue<APICategory>(initialValue: APICategory())
47-
public static internal(set) var API: APICategory {
47+
public internal(set) static var API: APICategory {
4848
get { apiAtomic.get() }
4949
set { apiAtomic.set(newValue) }
5050
}
5151

5252
/// - Tag: Amplify.Auth
5353
private static let authAtomic = AtomicValue<AuthCategory>(initialValue: AuthCategory())
54-
public static internal(set) var Auth: AuthCategory {
54+
public internal(set) static var Auth: AuthCategory {
5555
get { authAtomic.get() }
5656
set { authAtomic.set(newValue) }
5757
}
5858

5959
/// - Tag: Amplify.DataStore
6060
private static let dataStoreAtomic = AtomicValue<DataStoreCategory>(initialValue: DataStoreCategory())
61-
public static internal(set) var DataStore: DataStoreCategory {
61+
public internal(set) static var DataStore: DataStoreCategory {
6262
get { dataStoreAtomic.get() }
6363
set { dataStoreAtomic.set(newValue) }
6464
}
6565

6666
/// - Tag: Amplify.Geo
6767
private static let geoAtomic = AtomicValue<GeoCategory>(initialValue: GeoCategory())
68-
public static internal(set) var Geo: GeoCategory {
68+
public internal(set) static var Geo: GeoCategory {
6969
get { geoAtomic.get() }
7070
set { geoAtomic.set(newValue) }
7171
}
7272

7373
/// - Tag: Amplify.Hub
7474
private static let hubAtomic = AtomicValue<HubCategory>(initialValue: HubCategory())
75-
public static internal(set) var Hub: HubCategory {
75+
public internal(set) static var Hub: HubCategory {
7676
get { hubAtomic.get() }
7777
set { hubAtomic.set(newValue) }
7878
}
7979

8080
/// - Tag: Amplify.Notifications
8181
private static let notificationsAtomic = AtomicValue<NotificationsCategory>(initialValue: NotificationsCategory())
82-
public static internal(set) var Notifications: NotificationsCategory {
82+
public internal(set) static var Notifications: NotificationsCategory {
8383
get { notificationsAtomic.get() }
8484
set { notificationsAtomic.set(newValue) }
8585
}
8686

8787
/// - Tag: Amplify.Predictions
8888
private static let predictionsAtomic = AtomicValue<PredictionsCategory>(initialValue: PredictionsCategory())
89-
public static internal(set) var Predictions: PredictionsCategory {
89+
public internal(set) static var Predictions: PredictionsCategory {
9090
get { predictionsAtomic.get() }
9191
set { predictionsAtomic.set(newValue) }
9292
}
9393

9494
/// - Tag: Amplify.Storage
9595
private static let storageAtomic = AtomicValue<StorageCategory>(initialValue: StorageCategory())
96-
public static internal(set) var Storage: StorageCategory {
96+
public internal(set) static var Storage: StorageCategory {
9797
get { storageAtomic.get() }
9898
set { storageAtomic.set(newValue) }
9999
}
@@ -102,7 +102,7 @@ public class Amplify: @unchecked Sendable {
102102
/// methods during setup & teardown of tests
103103
///
104104
/// - Tag: Amplify.Logging
105-
public static internal(set) var Logging: LoggingCategory {
105+
public internal(set) static var Logging: LoggingCategory {
106106
get {
107107
loggingAtomic.get()
108108
}
@@ -112,13 +112,15 @@ public class Amplify: @unchecked Sendable {
112112
}
113113
private static let loggingAtomic = AtomicValue<LoggingCategory>(initialValue: LoggingCategory())
114114

115+
// swiftlint:disable cyclomatic_complexity
116+
115117
/// Adds `plugin` to the category
116118
///
117119
/// See: [Category.removePlugin(for:)](x-source-tag://Category.removePlugin)
118120
///
119121
/// - Parameter plugin: The plugin to add
120122
/// - Tag: Amplify.add_plugin
121-
public static func add<P: Plugin>(plugin: P) throws {
123+
public static func add(plugin: some Plugin) throws {
122124
log.debug("Adding plugin: \(plugin))")
123125
switch plugin {
124126
case let plugin as AnalyticsCategoryPlugin:
@@ -144,8 +146,11 @@ public class Amplify: @unchecked Sendable {
144146
default:
145147
throw PluginError.pluginConfigurationError(
146148
"Plugin category does not exist.",
147-
"Verify that the library version is correct and supports the plugin's category.")
149+
"Verify that the library version is correct and supports the plugin's category."
150+
)
148151
}
152+
153+
// swiftlint:enable cyclomatic_complexity
149154
}
150155
}
151156

Amplify/Categories/API/APICategory.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
/// The API category provides a solution for making HTTP requests to REST and GraphQL endpoints.
9-
final public class APICategory: Category {
9+
public final class APICategory: Category {
1010
/// The category type for API
1111
public var categoryType: CategoryType {
1212
.api
@@ -57,8 +57,10 @@ final public class APICategory: Category {
5757
let key = plugin.key
5858
guard !key.isEmpty else {
5959
let pluginDescription = String(describing: plugin)
60-
let error = APIError.invalidConfiguration("Plugin \(pluginDescription) has an empty `key`.",
61-
"Set the `key` property for \(String(describing: plugin))")
60+
let error = APIError.invalidConfiguration(
61+
"Plugin \(pluginDescription) has an empty `key`.",
62+
"Set the `key` property for \(String(describing: plugin))"
63+
)
6264
throw error
6365
}
6466

@@ -81,8 +83,10 @@ final public class APICategory: Category {
8183
public func getPlugin(for key: PluginKey) throws -> APICategoryPlugin {
8284
guard let plugin = plugins[key] else {
8385
let keys = plugins.keys.joined(separator: ", ")
84-
let error = APIError.invalidConfiguration("No plugin has been added for '\(key)'.",
85-
"Either add a plugin for '\(key)', or use one of the known keys: \(keys)")
86+
let error = APIError.invalidConfiguration(
87+
"No plugin has been added for '\(key)'.",
88+
"Either add a plugin for '\(key)', or use one of the known keys: \(keys)"
89+
)
8690
throw error
8791
}
8892
return plugin

Amplify/Categories/API/ClientBehavior/APICategory+ReachabilityBehavior.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77

88
#if canImport(Combine)
9-
import Foundation
109
import Combine
10+
import Foundation
1111

1212
extension APICategory: APICategoryReachabilityBehavior {
1313
#if !os(watchOS)

Amplify/Categories/API/ClientBehavior/APICategoryBehavior.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
/// Behavior of the API category that clients will use
99
public typealias APICategoryBehavior =
10-
APICategoryRESTBehavior &
10+
APICategoryAuthProviderFactoryBehavior &
1111
APICategoryGraphQLBehavior &
1212
APICategoryInterceptorBehavior &
13-
APICategoryReachabilityBehavior &
14-
APICategoryAuthProviderFactoryBehavior
13+
APICategoryRESTBehavior &
14+
APICategoryReachabilityBehavior

Amplify/Categories/API/ClientBehavior/APICategoryGraphQLBehavior.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public protocol APICategoryGraphQLBehavior: AnyObject {
3535
/// - request: The GraphQL request containing apiName, document, variables, and responseType
3636
/// - valueListener: Invoked when the GraphQL subscription receives a new value from the service
3737
/// - completionListener: Invoked when the subscription has terminated
38-
/// - Returns: The AmplifyInProcessReportingOperation being enqueued
38+
/// - Returns: The AmplifyInProcessReportingOperation being enqueued
3939
func subscribe<R: Decodable>(
4040
request: GraphQLRequest<R>
4141
) -> AmplifyAsyncThrowingSequence<GraphQLSubscriptionEvent<R>>

Amplify/Categories/API/ClientBehavior/APICategoryReachabilityBehavior.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77

88
#if canImport(Combine)
9-
import Foundation
109
import Combine
10+
import Foundation
1111

1212
/// API Reachability Behavior
1313
public protocol APICategoryReachabilityBehavior {

Amplify/Categories/API/Error/APIError.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ extension APIError: AmplifyError {
106106
For more information on HTTP status codes, take a look at
107107
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
108108
"""
109+
109110
case .pluginError(let error):
110111
return error.recoverySuggestion
111112
}

Amplify/Categories/API/Operation/AmplifyOperation+APIPublishers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77

88
#if canImport(Combine)
9-
import Foundation
109
import Combine
10+
import Foundation
1111

1212
// MARK: - GraphQLSubscriptionOperation
1313

Amplify/Categories/API/Operation/NondeterminsticOperation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
98
import Combine
9+
1010
/**
1111
A non-deterministic operation offers multiple paths to accomplish its task.
1212
It attempts the next path if all preceding paths have failed with an error that allows for continuation.
@@ -62,7 +62,7 @@ final class NondeterminsticOperation<T> {
6262
self?.task = Task { [weak self] in
6363
do {
6464
if let self {
65-
promise(.success(try await self.run()))
65+
try await promise(.success(run()))
6666
} else {
6767
promise(.failure(NondeterminsticOperationError.cancelled))
6868
}

0 commit comments

Comments
 (0)